Commit bcbdfa11 authored by Peter Müller's avatar Peter Müller

Fixed polling issue, Devices are no longer automatically removed if PCF8574IC device is removed

parent 988d5d19
Pipeline #119 passed with stages
in 26 seconds
## v1.0.1 2017-05-28
- Fixed polling issue
- Devices are no longer automatically removed if PCF8574IC device is removed
## v1.0.0 2017-05-28
- First official release
......@@ -32,8 +32,6 @@ The whole configuration can be made via the frontend in the *Devices* section.
You have to add one `PCF8574IC` device first, because the other devices will need this.
If you delete a `PCF8574IC` device, all devices associated to this device will also be deleted.
### Device PCF8574IC
......
......@@ -40,7 +40,7 @@ module.exports = {
extensions: ["xLink", "xClosedLabel", "xOpenedLabel"]
properties:
PCF8574IC:
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first. If the PCF8574IC device gets deleted, this PCF8574ContactSensor device will be deleted too."
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first."
type: "string"
enum: []
pinNumber:
......@@ -58,7 +58,7 @@ module.exports = {
extensions: ["xLink", "xPresentLabel", "xAbsentLabel"]
properties:
PCF8574IC:
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first. If the PCF8574IC device gets deleted, this PCF8574PresenceSensor device will be deleted too."
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first."
type: "string"
enum: []
pinNumber:
......@@ -76,7 +76,7 @@ module.exports = {
extensions: ["xConfirm", "xLink", "xOnLabel", "xOffLabel"]
properties:
PCF8574IC:
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first. If the PCF8574IC device gets deleted, this PCF8574Switch device will be deleted too."
description: "The ID of PCF8574IC device to which this device is connected. This device must be created first."
type: "string"
enum: []
pinNumber:
......@@ -98,7 +98,7 @@ module.exports = {
extensions: ["xConfirm", "xLink"]
properties:
up_PCF8574IC:
description: "The ID of PCF8574IC device to which the up direction of this device is connected. This device must be created first. If the PCF8574IC device gets deleted, this PCF8574Shutter device will be deleted too."
description: "The ID of PCF8574IC device to which the up direction of this device is connected. This device must be created first."
type: "string"
enum: []
up_pinNumber:
......@@ -113,7 +113,7 @@ module.exports = {
type: "integer"
default: 0
down_PCF8574IC:
description: "The ID of PCF8574IC device to which the down direction of this device is connected. This device must be created first. If the PCF8574IC device gets deleted, this PCF8574Shutter device will be deleted too."
description: "The ID of PCF8574IC device to which the down direction of this device is connected. This device must be created first."
type: "string"
enum: []
down_pinNumber:
......
......@@ -25,7 +25,7 @@
"pcf8574.coffee",
"README.md"
],
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://git.cryhost.de/crycode/pimatic-pcf8574",
"license": "GPL-2.0",
"repository": {
......
......@@ -98,7 +98,12 @@ module.exports = (env) ->
else if @config.inputChangeDetection == 'polling'
assert typeof @config.pollingInterval is 'number'
env.logger.debug "#{@id} polling for input changes every #{@config.pollingInterval} ms"
@pollingInterval = setInterval @ic.doPoll, @config.pollingInterval
@pollingInterval = setInterval ( =>
@ic.doPoll()
.catch( (err) =>
env.logger.warn "#{@id} Error while polling:", err
)
), @config.pollingInterval
# add to the other device classes configs
_.forEach pcf8574Devices, (device) =>
......@@ -110,13 +115,6 @@ module.exports = (env) ->
env.logger.debug "destroy #{@id}"
super()
# remove all devices which belongs to this device
_.forEach @framework.deviceManager.getDevices(), (device) =>
_.forEach pcf8574DevicesEnums, (deviceEnum) =>
if device.config[deviceEnum]? and device.config[deviceEnum] is @id
env.logger.info "removing device #{device.config.id} because it belongs to #{@id}"
@framework.deviceManager.removeDevice device.config.id
# remove from the other device classes configs
_.forEach pcf8574Devices, (device) =>
_.forEach pcf8574DevicesEnums, (deviceEnum) =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment