Skip to content

Commit

Permalink
bumped version to v0.9.9
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Aug 7, 2023
1 parent fd31434 commit 87854ae
Show file tree
Hide file tree
Showing 21 changed files with 200 additions and 145 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Tests

on:

# On which repository actions to trigger the build.
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allow job to be triggered manually.
workflow_dispatch:

# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

tests:

runs-on: ${{ matrix.os }}
strategy:

# Run all jobs to completion (false), or cancel
# all jobs once the first one fails (true).
fail-fast: true

# Define a minimal test matrix, it will be
# expanded using subsequent `include` items.
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10"]
bare: [false]

defaults:
run:
shell: bash

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
BARE: ${{ matrix.bare }}

name: Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.bare && '(bare)' || '' }}
steps:

- name: Acquire sources
uses: actions/checkout@v3

- name: Install prerequisites (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
- name: Install project dependencies (Baseline)
run: |
pip install -r requirements.txt -r dev-requirements.txt
# For saving resources, code style checking is
# only invoked within the `bare` environment.
- name: Check code style
if: matrix.bare == true
run: |
flake8 ultrasync --count --show-source --statistics
- name: Run tests
run: |
coverage run -m pytest
- name: Process coverage data
run: |
coverage xml
coverage report
- name: Upload coverage data
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# NX-595E Output Control Fork
This fork is designated to implementing the "Output Control" section of the NX-595E. The main objective is to enable communication with the outputs and ensure its proper implementation.

## How does output control work?
Output Control is handled through the `output.htm` file within the web app. From my understanding, Output Controls has two key value pairs that identify each output:
```
{
'name': "Garage Auto Door",
'state': "0",
}
```
In this example, the `name` is the name of the output and the `state` is whether the output is "on" or "off", 0 being "off" and 1 being "on"

To activate the Output Control switch, a post request is made to `/user/output.cgi` with the following parameters:
```
{
'sess': self.session_id,
'onum': 1,
'ostate': 1
}
```
In this example, the `sess` is referred to the session ID of the current login, `onum` is the index of the output (`'onum': 1` refers to the first output), and `ostate` which refers to the state in which you want to set the output (`'ostate': 1` means on and `'ostate': 0` means off).

# NX-595E UltraSync Hub

Compatible with both NX-595E [Hills](https://www.hills.com.au/) ComNav, xGen, xGen8 (such as [NXG-8-Z-BO](https://firesecurityproducts.com/en/product/intrusion/NXG_8_Z_BO/82651)), [Interlogix](https://www.interlogix.com/), and [ZeroWire](https://www.interlogix.com/intrusion/product/ultrasync-selfcontained-hub) UltraSync solutions.
Expand All @@ -30,7 +10,7 @@ Compatible with both NX-595E [Hills](https://www.hills.com.au/) ComNav, xGen, xG
[![Paypal](https://img.shields.io/badge/paypal-donate-green.svg)](https://paypal.me/lead2gold?locale.x=en_US)
[![Follow](https://img.shields.io/twitter/follow/l2gnux)](https://twitter.com/l2gnux/)<br/>
[![Python](https://img.shields.io/pypi/pyversions/ultrasync.svg?style=flat-square)](https://pypi.org/project/ultrasync/)
[![Build Status](https://travis-ci.org/caronc/ultrasync.svg?branch=master)](https://travis-ci.org/caronc/ultrasync)
[![Build Status](https://github.com/caronc/ultrasync/actions/workflows/tests.yml/badge.svg)](https://github.com/caronc/ultrasync/actions/workflows/tests.yml)
[![CodeCov Status](https://codecov.io/github/caronc/ultrasync/branch/master/graph/badge.svg)](https://codecov.io/github/caronc/ultrasync)
[![Downloads](http://pepy.tech/badge/ultrasync)](https://pypi.org/project/ultrasync/)

Expand Down
2 changes: 1 addition & 1 deletion bin/checkdone.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright (C) 2020 Chris Caron <[email protected]>
# All rights reserved.
#
Expand Down
2 changes: 1 addition & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright (C) 2020 Chris Caron <[email protected]>
# All rights reserved.
#
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ addopts = --verbose -ra
python_files = tests/test_*.py
filterwarnings =
once::Warning
strict = true
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

setup(
name='ultrasync',
version='0.9.8',
version='0.9.9',
description='Wrapper to XGen/XGen8/Hills/Interlogix NX-595E/UltraSync '
'ZeroWire',
license='MIT',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
from importlib import reload
import requests
from os.path import join
Expand Down
15 changes: 12 additions & 3 deletions tests/test_comnav_0_106.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down Expand Up @@ -87,8 +87,15 @@ def test_comnav_0_106_communication(mock_post):
ast_obj.content = f.read()
ast_obj.status_code = requests.codes.ok

# A Control response object (for garage door handling)
# At the time, i did not have a sample to work with, so we will use empty
# data for now to satisfy tests
crobj = mock.Mock()
crobj.status_code = requests.codes.ok
crobj.content = b''

# Assign our response object to our mocked instance of requests
mock_post.side_effect = (arobj, zrobj)
mock_post.side_effect = (arobj, zrobj, crobj)

uobj = UltraSync()

Expand Down Expand Up @@ -139,11 +146,13 @@ def test_comnav_0_106_communication(mock_post):
assert uobj.zones[entry['bank']]['can_bypass'] is True

# A call to login.cgi (which fetches area.html) and then zones.htm
assert mock_post.call_count == 2
assert mock_post.call_count == 3
assert mock_post.call_args_list[0][0][0] == \
'http://zerowire/login.cgi'
assert mock_post.call_args_list[1][0][0] == \
'http://zerowire/user/zones.htm'
assert mock_post.call_args_list[2][0][0] == \
'http://zerowire/user/outputs.htm'

# Reset our mock object
mock_post.reset_mock()
Expand Down
15 changes: 12 additions & 3 deletions tests/test_comnav_0_108-zone-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down Expand Up @@ -87,8 +87,15 @@ def test_comnav_0_108_zone_filter(mock_post):
ast_obj.content = f.read()
ast_obj.status_code = requests.codes.ok

# A Control response object (for garage door handling)
# At the time, i did not have a sample to work with, so we will use empty
# data for now to satisfy tests
crobj = mock.Mock()
crobj.status_code = requests.codes.ok
crobj.content = b''

# Assign our response object to our mocked instance of requests
mock_post.side_effect = (arobj, zrobj)
mock_post.side_effect = (arobj, zrobj, crobj)

uobj = UltraSync()

Expand Down Expand Up @@ -118,11 +125,13 @@ def test_comnav_0_108_zone_filter(mock_post):
assert len(uobj.zones) == 17

# A call to login.cgi (which fetches area.html) and then zones.htm
assert mock_post.call_count == 2
assert mock_post.call_count == 3
assert mock_post.call_args_list[0][0][0] == \
'http://zerowire/login.cgi'
assert mock_post.call_args_list[1][0][0] == \
'http://zerowire/user/zones.htm'
assert mock_post.call_args_list[2][0][0] == \
'http://zerowire/user/outputs.htm'

# Reset our mock object
mock_post.reset_mock()
Expand Down
15 changes: 12 additions & 3 deletions tests/test_comnav_0_108.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down Expand Up @@ -87,8 +87,15 @@ def test_comnav_0_108_communication(mock_post):
ast_obj.content = f.read()
ast_obj.status_code = requests.codes.ok

# A Control response object (for garage door handling)
# At the time, i did not have a sample to work with, so we will use empty
# data for now to satisfy tests
crobj = mock.Mock()
crobj.status_code = requests.codes.ok
crobj.content = b''

# Assign our response object to our mocked instance of requests
mock_post.side_effect = (arobj, zrobj)
mock_post.side_effect = (arobj, zrobj, crobj)

uobj = UltraSync()

Expand Down Expand Up @@ -138,11 +145,13 @@ def test_comnav_0_108_communication(mock_post):
assert uobj.zones[entry['bank']]['can_bypass'] is True

# A call to login.cgi (which fetches area.html) and then zones.htm
assert mock_post.call_count == 2
assert mock_post.call_count == 3
assert mock_post.call_args_list[0][0][0] == \
'http://zerowire/login.cgi'
assert mock_post.call_args_list[1][0][0] == \
'http://zerowire/user/zones.htm'
assert mock_post.call_args_list[2][0][0] == \
'http://zerowire/user/outputs.htm'

# Reset our mock object
mock_post.reset_mock()
Expand Down
15 changes: 12 additions & 3 deletions tests/test_comnav_0_108_burglar_alarm_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down Expand Up @@ -87,8 +87,15 @@ def test_comnav_0_108_active_burglary(mock_post):
ast_obj.content = f.read()
ast_obj.status_code = requests.codes.ok

# A Control response object (for garage door handling)
# At the time, i did not have a sample to work with, so we will use empty
# data for now to satisfy tests
crobj = mock.Mock()
crobj.status_code = requests.codes.ok
crobj.content = b''

# Assign our response object to our mocked instance of requests
mock_post.side_effect = (arobj, zrobj)
mock_post.side_effect = (arobj, zrobj, crobj)

uobj = UltraSync()

Expand Down Expand Up @@ -138,8 +145,10 @@ def test_comnav_0_108_active_burglary(mock_post):
assert uobj.zones[entry['bank']]['can_bypass'] is True

# A call to login.cgi (which fetches area.html) and then zones.htm
assert mock_post.call_count == 2
assert mock_post.call_count == 3
assert mock_post.call_args_list[0][0][0] == \
'http://zerowire/login.cgi'
assert mock_post.call_args_list[1][0][0] == \
'http://zerowire/user/zones.htm'
assert mock_post.call_args_list[2][0][0] == \
'http://zerowire/user/outputs.htm'
2 changes: 1 addition & 1 deletion tests/test_xgen8_bypass.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xgen8_nxg8zbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xgen_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down
2 changes: 1 addition & 1 deletion tests/test_zerowire_armed.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down
2 changes: 1 addition & 1 deletion tests/test_zerowire_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import mock
from unittest import mock
import requests
from os.path import join
from os.path import dirname
Expand Down
Loading

0 comments on commit 87854ae

Please sign in to comment.