Skip to content

Commit

Permalink
Dev 1.0.19 (#19)
Browse files Browse the repository at this point in the history
### Added
- new accessory `PLC_Doorbell`
### Fixed
- `PLC_Thermostat` name of parameter corrected to `get_CurrentHeatingCoolingState` previous incorrect name `get_CurrentHeaterCoolerState` *check your config*
- `PLC_Thermostat` did not poll CurrentHeatingCoolingState when polling was enabled
- `PLC_StatelessProgrammableSwitch` simulating switch event by control interface (http request) did not work
  • Loading branch information
Feilner authored Nov 19, 2020
1 parent b1e6fc0 commit b172d68
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 295 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file.

## [1.0.19] - 2020-11-19

### Added
- new accessory `PLC_Doorbell`
### Fixed
- `PLC_Thermostat` name of parameter corrected to `get_CurrentHeatingCoolingState` previous incorrect name `get_CurrentHeaterCoolerState` *check your config*
- `PLC_Thermostat` did not poll CurrentHeatingCoolingState when polling was enabled
- `PLC_StatelessProgrammableSwitch` simulating switch event by control interface (http request) did not work

## [1.0.18] - 2020-11-16

### Changed
Expand Down
95 changes: 64 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ SIEMENS S7 PLC plugin for [Homebridge](https://homebridge.io)
- and compatible PLCs e.g. Yaskawa or VIPA
- Tested with S7-300 compatible PLC and S7-1200
- Implementation is based on documentation of the [Homebridge API](https://developers.homebridge.io)
- Supports [**polling**](#poll) from homebridge-plc plugin to PLC by per accessory defined interval
- Supports [**polling**](#poll) of PLC from homebridge-plc plugin by per accessory defined interval
- Supports [**push**](#push) from PLC to homebridge-plc plugin by http PUT/GET
- Supports [**control**](#control) of PLC accessories by http PUT/GET (experimental)
- Supports [**control**](#control) of PLC accessories by http PUT/GET
- Supported Accessories:
* [LightBulb as `PLC_LightBulb`](#PLC_LightBulb)
* [Outlet as `PLC_Outlet`](#PLC_Outlet)
Expand All @@ -32,7 +32,8 @@ SIEMENS S7 PLC plugin for [Homebridge](https://homebridge.io)
* [Security System as `PLC_SecuritySystem`](#PLC_SecuritySystem)
* [Faucet as `PLC_Faucet`](#PLC_Faucet)
* [Valve as `PLC_Valve`](#PLC_Valve)
* [Button attached to PLC as `PLC_StatelessProgrammableSwitch`](#PLC_StatelessProgrammableSwitch)
* [Push button attached to PLC as `PLC_StatelessProgrammableSwitch`](#PLC_StatelessProgrammableSwitch)
* [Doorbell push button to PLC as `PLC_Doorbell`](#PLC_StatelessProgrammableSwitch)
* [Lock mechanism as `PLC_LockMechanism`](#PLC_LockMechanism)
* [Boolean lock mechanism as `PLC_LockMechanismBool`](#PLC_LockMechanismBool)
* [Garage door as `PLC_GarageDoorOpener`](#PLC_GarageDoorOpener)
Expand All @@ -45,7 +46,7 @@ SIEMENS S7 PLC plugin for [Homebridge](https://homebridge.io)
- Edit `config.json` to add the plc platform and its accessories.
- Run Homebridge

- Install via Homebridge UI
- Install via Homebridge UI (recommended)
- Search for `plc` on the plugin screen of [config-ui-x](https://github.com/oznu/homebridge-config-ui-x) .
- Find `homebridge-plc`
- Click install.
Expand Down Expand Up @@ -171,7 +172,7 @@ temperature sensor and temperature regulation
- `minValue` default value: 15
- `maxValue` default value: 27
- `minStep` default value: 1
- `get_CurrentHeaterCoolerState`: (optional) current heating/cooling state when not present fixed `1` is used S7 type `Byte` e.g. `8` for `DB4DBB58`
- `get_CurrentHeatingCoolingState`: (optional) current heating/cooling state when not present fixed `1` is used S7 type `Byte` e.g. `8` for `DB4DBB58`
- `0`: inactive
- `1`: idle
- `2`: heating
Expand All @@ -185,7 +186,7 @@ temperature sensor and temperature regulation


### <a name='PLC_Window'></a>Shutters as `PLC_WindowCovering`, windows as `PLC_Window` and doors as `PLC_Door`
shutters or blinds as well sensors for windows and doors
motor driven blinds, windows and doors. Supports also manual driven blinds, windows and doors to show just the current position in percent. *Note:* If your sensor shows only open/close may also have a look at [`PLC_ContactSensor`](#PLC_ContactSensor).

![homebridge pic](doc/blind.png) ![homebridge pic](doc/window.png) ![homebridge pic](doc/door.png)
- `name`: unique name of the accessory
Expand Down Expand Up @@ -312,7 +313,7 @@ valve configurable as generic valve, irrigation, shower head or water faucet
- `set_SetDuration`: (optional) duration 0..3600 sec S7 type `Time` e.g. `14` for `DB4DBD14`
- `get_RemainingDuration`: (optional) duration 0..3600 sec S7 type `Time` e.g. `18` for `DB4DBD18`

### <a name='PLC_StatelessProgrammableSwitch'></a>Button as `PLC_StatelessProgrammableSwitch`
### <a name='PLC_StatelessProgrammableSwitch'></a>Button as `PLC_StatelessProgrammableSwitch`, Doorbell as `PLC_Doorbell`
stateless switch from PLC to home app. Trigger actions in home app only works with control center e.g. AppleTV or HomePod.
It will works only in polling or push mode! The PLC sets a bit that is regularly polled by homebridge after successful reading a 1 of the event the bit it will report the event and set the bit to 0. Change 0->1 is done by PLC change from 1->0 is done by homebridge-plc! In push mode the new value is just pushed with the db and offset of `get_ProgrammableSwitchEvent`

Expand Down Expand Up @@ -351,7 +352,7 @@ Lock mechanism (not yet clear how to use changes are welcome)
- `1`: secured

### <a name='PLC_LockMechanismBool'></a>Boolean lock mechanism as `PLC_LockMechanismBool`
Lock mechanism implemented as bool on the PLC. **NOTE: The convention `0`:closed/secured `1`:open/unsecured**
Lock mechanism implemented as bool on the PLC. **NOTE: The convention `0`=`false`: closed/secured `1`=`true`: open/unsecured**

![homebridge pic](doc/lockbool.png)
- `name`: unique name of the accessory
Expand All @@ -361,18 +362,18 @@ Lock mechanism implemented as bool on the PLC. **NOTE: The convention `0`:closed
- `pollInterval` (optional) poll interval in seconds. Default value is `10` seconds.
- `forceCurrentState`: (optional) when set to `true` the position set by `set_LockTargetState` is directly used as current state. By this it seems in the home app as the target state was directly reached. This is recommended when not sing `enablePolling` or pushing the value from the plc.
- `get_LockCurrentState`: offset to read current state current state S7 type `Bool` .g. `3.1` for `DB4DBB3`
- `0`: secured
- `1`: unsecured
- `false`: secured
- `true`: unsecured
- `get_LockTargetState`: offset to read target state current state S7 type `Bool` e.. `3.1` for `DB4DBB3`
- `0`: secured
- `1`: unsecured
- `false`: secured
- `true`: unsecured
- Single Bit for secure/unsecured:
- `set_LockTargetState`: offset to write target state current state S7 type `Bool` e.g. `3.1` for `DB4DBB3`
- `0`: secured
- `1`: unsecured
- `false`: secured
- `true`: unsecured
- Separate Bits for secure/unsecured:
- `set_Secured`: offset and bit set to 1 when switching to target state secured S7 type `Bool` **PLC has to set to 0** e.g. `3.3` for `DB4DBX55.1`
- `set_Unsecured`: offset and bit set to 1 when switching to target state unsecured S7 type `Bool` **PLC has to set to 0** e.g. `3.4` for `DB4DBX55.2`
- `set_Secured`: offset and bit set to `true` when switching to target state secured S7 type `Bool` **PLC has to set to false** e.g. `3.3` for `DB4DBX55.1`
- `set_Unsecured`: offset and bit set to `true` when switching to target state unsecured S7 type `Bool` **PLC has to set to false** e.g. `3.4` for `DB4DBX55.2`


### <a name='PLC_GarageDoorOpener'></a>Garage door as `PLC_GarageDoorOpener`
Expand Down Expand Up @@ -497,7 +498,7 @@ Note: The example is just an example it contains also some optional settings. Fo
"get_CurrentTemperature": 12,
"get_TargetTemperature": 16,
"set_TargetTemperature": 16,
"get_CurrentHeaterCoolerState": 20
"get_CurrentHeatingCoolingState": 20
},
{
"accessory": "PLC_WindowCovering",
Expand Down Expand Up @@ -614,6 +615,15 @@ Note: The example is just an example it contains also some optional settings. Fo
"isEvent": 29.2,
"get_ProgrammableSwitchEvent": 38
},
{
"accessory": "PLC_Doorbell",
"name": "Doorbell",
"enablePolling": true,
"pollInterval": 10,
"db": 12,
"isEvent": 29.2,
"get_ProgrammableSwitchEvent": 38
},
{
"accessory": "PLC_LockMechanism",
"name": "Lock",
Expand Down Expand Up @@ -656,17 +666,40 @@ There are three possible ways to workaround this.
2. You enable the polling mode
3. You enable the push mode and instrument your PLC code to send the values

## <a name='poll'></a>Poll values form PLC
To enable this you have to set `"enablePolling": true;` platform level and on each individual accessory with individual interval in seconds.
`"enablePolling": true, "pollInterval": 30,`
## <a name='poll'></a>Poll values form PLC by homebridge-PLC plugin
To enable this you have to set `"enablePolling": true;` platform level and on each individual accessory with individual interval in seconds `"enablePolling": true, "pollInterval": 10,`

Example to poll the contact sensor state every 10 seconds
{
"platforms": [
{
"platform": "PLC",
"ip": "10.10.10.32",
"rack": 0,
"slot": 2,
"enablePolling": true,
"accessories": [
{
"accessory": "PLC_ContactSensor",
"name": "ContactSensor",
"enablePolling": true,
"pollInterval": 10,
"db": 12,
"get_ContactSensorState": 25.2
}
]
}
]
}

## <a name='push'></a>Push values from PLC
## <a name='push'></a>Push values from PLC to homebridge-plc plugin

It possible to send updates of values directly from the plc to the homebridge-plc plugin. This is especially useful when you want notifications form your home app about open/close of doors or just a faster response e.g. with PLC_StatelessProgrammableSwitch.
To enable this you have to set `"enablePush": true,` platform level and optional the `port`.

The push takes place via an http request to the configured port with the keyword "push". In order to avoid that additional configurations between the PLC and the Homebrige-plc-Plugin have to be synchronized, the interface is kept very simple. The interface that the PLC operates consists only of the keyword 'push', the database number 'db', the address within the db 'offset' and the value 'value'.
The push takes place via an http request to the configured port with the keyword "push". In order to avoid that additional configurations to be shared between the PLC and the homebrige-plc-Plugin, the interface is kept very simple.
The interface that the PLC has to use consists only of the keyword 'push', the database number 'db', the address within the db 'offset' and the value 'value'. This allows to on the PLC to create a simple interface to push changed values to the homebridge-plc plugin e.g. I created a FC with just one input of type `ANY` to push all kind of values.

The value is assigned to all matching ('db' and 'offset') get_* accessory configurations. All information is transmitted within the URL and in decimal.

For example the push from the PLC is done as 'http://homebridgeIp:8080/?push&db=1014&offset=1&value=3'
Expand All @@ -681,15 +714,15 @@ With the following configuration:
"slot": 2,
"enablePush": true,
"accessories": [
{
"accessory": "PLC_SecuritySystem",
"name": "AlarmSystem",
"db": 1014,
"get_SecuritySystemCurrentState": 1,
"set_SecuritySystemTargetState": 1,
"get_SecuritySystemTargetState": 1
}
]
{
"accessory": "PLC_SecuritySystem",
"name": "AlarmSystem",
"db": 1014,
"get_SecuritySystemCurrentState": 1,
"set_SecuritySystemTargetState": 1,
"get_SecuritySystemTargetState": 1
}
]
}
]
}
Expand Down
Loading

0 comments on commit b172d68

Please sign in to comment.