Skip to content

Commit

Permalink
Better logging, unit offline handeling and allow IP changes. Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Joolee committed May 27, 2020
1 parent 9bd44fd commit 7391708
Show file tree
Hide file tree
Showing 17 changed files with 385 additions and 165 deletions.
43 changes: 0 additions & 43 deletions .homeycompose/drivers/settings/connectionSettings.json

This file was deleted.

41 changes: 41 additions & 0 deletions .homeycompose/drivers/settings/unitInfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"type": "group",
"label": {
"en": "Unit information"
},
"children": [
{
"id": "mac",
"type": "label",
"label": {
"en": "MAC Address"
},
"value": "",
"hint": {
"en": "The MAC Address of your ESP Easy unit. This is the identifier Homey uses for your unit. Any incoming messages will be matched by MAC addres so if the IP address does not match, it is updated on Homey's end."
}
},
{
"id": "host",
"type": "label",
"label": {
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "idx",
"type": "label",
"label": {
"en": "Unit ID"
},
"value": "",
"hint": {
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
}
146 changes: 85 additions & 61 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
],
"settings": [
{
"id": "connectionSettings",
"id": "unitInfo",
"type": "group",
"label": {
"en": "Connection settings"
"en": "Unit information"
},
"children": [
{
Expand All @@ -81,26 +81,24 @@
},
{
"id": "host",
"type": "text",
"type": "label",
"label": {
"en": "IP Address or hostname"
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP Address of your ESP Easy unit. Will be updated automatically if any events from the unit (identified by MAC address) arrive with a different IP address. If you only use output pins (which will not send events), you can add a 'System Info' device to the ESP unit, it will send events to Homey every minute."
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "port",
"type": "number",
"id": "idx",
"type": "label",
"label": {
"en": "Port number"
"en": "Unit ID"
},
"value": 80,
"min": 0,
"max": 65535,
"value": "",
"hint": {
"en": "Should be port 80 as ESP Easy doesn't support running on another port at the moment."
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
Expand Down Expand Up @@ -170,10 +168,10 @@
],
"settings": [
{
"id": "connectionSettings",
"id": "unitInfo",
"type": "group",
"label": {
"en": "Connection settings"
"en": "Unit information"
},
"children": [
{
Expand All @@ -189,26 +187,24 @@
},
{
"id": "host",
"type": "text",
"type": "label",
"label": {
"en": "IP Address or hostname"
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP Address of your ESP Easy unit. Will be updated automatically if any events from the unit (identified by MAC address) arrive with a different IP address. If you only use output pins (which will not send events), you can add a 'System Info' device to the ESP unit, it will send events to Homey every minute."
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "port",
"type": "number",
"id": "idx",
"type": "label",
"label": {
"en": "Port number"
"en": "Unit ID"
},
"value": 80,
"min": 0,
"max": 65535,
"value": "",
"hint": {
"en": "Should be port 80 as ESP Easy doesn't support running on another port at the moment."
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
Expand Down Expand Up @@ -286,10 +282,10 @@
],
"settings": [
{
"id": "connectionSettings",
"id": "unitInfo",
"type": "group",
"label": {
"en": "Connection settings"
"en": "Unit information"
},
"children": [
{
Expand All @@ -305,26 +301,24 @@
},
{
"id": "host",
"type": "text",
"type": "label",
"label": {
"en": "IP Address or hostname"
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP Address of your ESP Easy unit. Will be updated automatically if any events from the unit (identified by MAC address) arrive with a different IP address. If you only use output pins (which will not send events), you can add a 'System Info' device to the ESP unit, it will send events to Homey every minute."
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "port",
"type": "number",
"id": "idx",
"type": "label",
"label": {
"en": "Port number"
"en": "Unit ID"
},
"value": 80,
"min": 0,
"max": 65535,
"value": "",
"hint": {
"en": "Should be port 80 as ESP Easy doesn't support running on another port at the moment."
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
Expand Down Expand Up @@ -380,10 +374,10 @@
],
"settings": [
{
"id": "connectionSettings",
"id": "unitInfo",
"type": "group",
"label": {
"en": "Connection settings"
"en": "Unit information"
},
"children": [
{
Expand All @@ -399,26 +393,24 @@
},
{
"id": "host",
"type": "text",
"type": "label",
"label": {
"en": "IP Address or hostname"
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP Address of your ESP Easy unit. Will be updated automatically if any events from the unit (identified by MAC address) arrive with a different IP address. If you only use output pins (which will not send events), you can add a 'System Info' device to the ESP unit, it will send events to Homey every minute."
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "port",
"type": "number",
"id": "idx",
"type": "label",
"label": {
"en": "Port number"
"en": "Unit ID"
},
"value": 80,
"min": 0,
"max": 65535,
"value": "",
"hint": {
"en": "Should be port 80 as ESP Easy doesn't support running on another port at the moment."
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
Expand Down Expand Up @@ -485,10 +477,10 @@
],
"settings": [
{
"id": "connectionSettings",
"id": "unitInfo",
"type": "group",
"label": {
"en": "Connection settings"
"en": "Unit information"
},
"children": [
{
Expand All @@ -504,26 +496,24 @@
},
{
"id": "host",
"type": "text",
"type": "label",
"label": {
"en": "IP Address or hostname"
"en": "Unit host"
},
"value": "",
"hint": {
"en": "The IP Address of your ESP Easy unit. Will be updated automatically if any events from the unit (identified by MAC address) arrive with a different IP address. If you only use output pins (which will not send events), you can add a 'System Info' device to the ESP unit, it will send events to Homey every minute."
"en": "The IP address can be changed in the unit settings or it will change automagically when Homey receives an event from another IP with the same MAC address"
}
},
{
"id": "port",
"type": "number",
"id": "idx",
"type": "label",
"label": {
"en": "Port number"
"en": "Unit ID"
},
"value": 80,
"min": 0,
"max": 65535,
"value": "",
"hint": {
"en": "Should be port 80 as ESP Easy doesn't support running on another port at the moment."
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
}
]
Expand Down Expand Up @@ -619,7 +609,6 @@
],
"settings": [
{
"id": "connectionSettings",
"type": "group",
"label": {
"en": "Connection settings"
Expand All @@ -636,6 +625,17 @@
"en": "The MAC Address of your ESP Easy unit. This is the identifier Homey uses for your unit. Any incoming messages will be matched by MAC addres so if the IP address does not match, it is updated on Homey's end."
}
},
{
"id": "idx",
"type": "label",
"label": {
"en": "Unit ID"
},
"value": "",
"hint": {
"en": "As defined on the ESP Easy settings page. Is currently not used to identify a unit, we use the MAC address for that"
}
},
{
"id": "host",
"type": "text",
Expand All @@ -661,6 +661,30 @@
}
}
]
},
{
"type": "group",
"label": {
"en": "Device settings"
},
"children": [
{
"id": "pollInterval",
"type": "number",
"label": {
"en": "Polling interval"
},
"value": 60,
"min": 5,
"max": 3600,
"units": {
"en": "seconds"
},
"hint": {
"en": "Request pin status from the unit and re-initialize the pin when, for example, a unit reboot or other app has changed the state"
}
}
]
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions assets/pairing/GPIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ document.body.addEventListener('click', (event) => {
"pin": pin.id
},
"settings": {
"host": unit.host,
"port": unit.port,
"mac": unit.mac
"mac": unit.mac,
"host": unit.host + ':' + unit.port,
"idx": unit.idx
},
capabilities: []
}
Expand Down
Loading

0 comments on commit 7391708

Please sign in to comment.