Skip to content

Commit

Permalink
Merge pull request #47 from alydersen/bug/dimmer_update
Browse files Browse the repository at this point in the history
Fixing bug in dimmer update from bus
  • Loading branch information
alydersen authored Nov 21, 2022
2 parents 49ef4f8 + 185b0ce commit dd1c1df
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,8 @@
},
"1.0.3": {
"en": "Range check on values and fixing pairing bug for floorheaters"
},
"1.0.4": {
"en": "Fixed bug in updaing level of dimmers from bus"
}
}
2 changes: 1 addition & 1 deletion .homeycompose/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "com.github.alydersen.hdl-smartbus-homey",
"version": "1.0.3",
"version": "1.0.4",
"compatibility": ">=5.0.0",
"sdk": 3,
"name": {
Expand Down
2 changes: 1 addition & 1 deletion DEVICES_DIMMERS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Back to the main page](index.md)

# Dimmers
A dimmer controller have one or more dimmers as channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.
A dimmer controller have one or more dimmers as channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.

Dimmers are a built-in capability in Homey, and as such have very good Homey support.

Expand Down
2 changes: 1 addition & 1 deletion DEVICES_MULTISENSORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ As you can see in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-
Keep in mind that since homey needs to have received a signal containing the capability's state before the capability is added, several minutes can go by before you have a device with all it's capabilites in Homey.

### Exclusions
Sometimes the signal from a device will contain state for a capability that is not supported for it. [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/hdl/hdl_devicelist.js) contains a "exclude" option for these per device type, so that it will be disregarded. If you want more added here - follow the [Contribution guidelines](CONTRIBUTING.md)
Sometimes the signal from a device will contain state for a capability that is not supported for it. [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/hdl/hdl_devicelist.js) contains a "exclude" option for these per device type, so that it will be disregarded. If you want more added here - follow the [Contribution guidelines](CONTRIBUTING.md)

## Making motion stable
The different multisensor types handles motion a bit different, making trusting the signal received a bit difficult. If you want this to be stable, configure your sensor to send an Universal Switch (UVS) with the value set to "ON" to the device ID of your Homey app. The UVS number that the app will expect is 212, but you can change this in the settings. The ID of your Homey App is configured in your settings. You should also add a similar action for "OFF" sent to the same ID.
Expand Down
2 changes: 1 addition & 1 deletion DEVICES_RELAYS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Back to the main page](index.md)

# Relays
A relay controller have one or more on/off capable channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.
A relay controller have one or more on/off capable channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.

ON/OFF switches are a built-in capability in Homey, and as such have very good Homey support.
2 changes: 1 addition & 1 deletion DEVICES_TEMPSENSORS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Back to the main page](index.md)

# Temperature Sensors
A temperature sensor controller have one or more temperature sensors as channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.
A temperature sensor controller have one or more temperature sensors as channels. Different HDL Models have different number of channels, and you see this in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/hdl/hdl_devicelist.js) under each type as "channels". You always add each separate channel as a Homey device, and they will as such be shown indivdually in the process of adding them.

Temperature sensors are a built-in capability in Homey, and as such have very good Homey support.

Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_comment": "This file is generated. Please edit .homeycompose/app.json instead.",
"id": "com.github.alydersen.hdl-smartbus-homey",
"version": "1.0.3",
"version": "1.0.4",
"compatibility": ">=5.0.0",
"sdk": 3,
"name": {
Expand Down
14 changes: 6 additions & 8 deletions drivers/dimmer/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@ class DimmerDriver extends Homey.Driver {
if (signal.data == undefined) return;
if (signal.sender.id == undefined) return;

if (signal.data.channel != undefined) {
if (signal.data.channel != undefined && signal.data.level != undefined) {
// This signal contains one channel, so we can process only that channel
if (signal.data.level != undefined) {
let homeyDevice = this.getDeviceFromSignal(signal, signal.data.channel);
if ( typeof homeyDevice === 'undefined' || homeyDevice instanceof Error ) return;
device.updateHomeyLevel(signal.data.level);
}
let homeyDevice = this.getDeviceFromSignal(signal, signal.data.channel);
if ( typeof homeyDevice === 'undefined' || homeyDevice instanceof Error ) return;
homeyDevice.updateHomeyLevel(signal.data.level);
}

if (signal.data.channels != undefined) {
// This signal contains all channels, we need to process it for every channel
signal.data.channels.forEach((chnl, index) => {
if (signal.data.channels[index].level != undefined) {
if (chnl.level != undefined) {
let homeyDevice = this.getDeviceFromSignal(signal, chnl.number);
if ( typeof homeyDevice === 'undefined' || homeyDevice instanceof Error ) return;
device.updateHomeyLevel(signal.data.level);
homeyDevice.updateHomeyLevel(chnl.level);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can find trubleshooting tips in the connection howto link above.
If you are a developer and want to add a new driver for the app, read the [Contribution guidelines](CONTRIBUTING.md).

### How devices are recognized
The App will listen to signals on the bus. For each signal, it will look into the sender type id and check that against a list of supported devices. A list of devices known by the documentation can be found [this Excel file](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/assets/defDeviceType.xlsx) (the type IDs from column A). TheID is then used in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.3/hdl/hdl_devicelist.js) to connect it to a specific driver. Sometimes more device types can simply be added to hdl_devicelist.js to be known. If you suspect this to be the case, raise an [Issue in Github](CONTRIBUTING.md). Universal Switches are different, so read up on them below.
The App will listen to signals on the bus. For each signal, it will look into the sender type id and check that against a list of supported devices. A list of devices known by the documentation can be found [this Excel file](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/assets/defDeviceType.xlsx) (the type IDs from column A). TheID is then used in [hdl_devicelist.js](https://github.com/alydersen/hdl-smartbus-homey/blob/v1.0.4/hdl/hdl_devicelist.js) to connect it to a specific driver. Sometimes more device types can simply be added to hdl_devicelist.js to be known. If you suspect this to be the case, raise an [Issue in Github](CONTRIBUTING.md). Universal Switches are different, so read up on them below.

### How the device state is set
Devices broadcasts their state on the bus and the Homey App reads them and updates the state on your Homey device if it is added. Sometimes, state is not published as it is happening (for various reasons). The app will reach out to every device every minute with a signal on the bus to make it publish its state. This means that sometimes, you'll have to wait a minute before you have an updated state.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.github.alydersen.homey-smartbus",
"version": "1.0.3",
"version": "1.0.4",
"main": "app.js",
"devDependencies": {
"@types/homey": "npm:homey-apps-sdk-v3-types@^0.3.1"
Expand Down

0 comments on commit dd1c1df

Please sign in to comment.