aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-10-05 01:36:24 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-10-05 01:36:24 +0300
commit17b447646752cb141c30684046906961e8d0af9f (patch)
tree251e459fce0b781726107791cb667d40a07362b8
parent69adc549d317217b275a3e0cca689a9b1e7d3263 (diff)
pio, mqtt: multiple fixes
-rw-r--r--include/pio/libs/mqtt/homekit/mqtt/mqtt.cpp2
-rw-r--r--include/pio/libs/mqtt/library.json2
-rw-r--r--include/pio/libs/temphum/library.json2
-rw-r--r--include/py/homekit/mqtt/_config.py7
-rw-r--r--include/py/homekit/mqtt/module/ota.py2
-rw-r--r--include/py/homekit/pio/products.py7
6 files changed, 17 insertions, 5 deletions
diff --git a/include/pio/libs/mqtt/homekit/mqtt/mqtt.cpp b/include/pio/libs/mqtt/homekit/mqtt/mqtt.cpp
index aa769a5..83764ca 100644
--- a/include/pio/libs/mqtt/homekit/mqtt/mqtt.cpp
+++ b/include/pio/libs/mqtt/homekit/mqtt/mqtt.cpp
@@ -119,7 +119,7 @@ void Mqtt::reconnect() {
void Mqtt::disconnect() {
// TODO test how this works???
reconnectTimer.detach();
- client.disconnect();
+ client.disconnect(true);
}
void Mqtt::loop() {
diff --git a/include/pio/libs/mqtt/library.json b/include/pio/libs/mqtt/library.json
index f3f2504..6238c21 100644
--- a/include/pio/libs/mqtt/library.json
+++ b/include/pio/libs/mqtt/library.json
@@ -1,6 +1,6 @@
{
"name": "homekit_mqtt",
- "version": "1.0.11",
+ "version": "1.0.12",
"build": {
"flags": "-I../../include"
}
diff --git a/include/pio/libs/temphum/library.json b/include/pio/libs/temphum/library.json
index 329b7ca..4cf5c63 100644
--- a/include/pio/libs/temphum/library.json
+++ b/include/pio/libs/temphum/library.json
@@ -1,6 +1,6 @@
{
"name": "homekit_temphum",
- "version": "1.0.3",
+ "version": "1.0.4",
"build": {
"flags": "-I../../include"
}
diff --git a/include/py/homekit/mqtt/_config.py b/include/py/homekit/mqtt/_config.py
index e5f2c56..4916d8a 100644
--- a/include/py/homekit/mqtt/_config.py
+++ b/include/py/homekit/mqtt/_config.py
@@ -109,7 +109,12 @@ class MqttNodesConfig(ConfigUnit):
'legacy_topics': {'type': 'boolean'}
}
},
- 'password': {'type': 'string'}
+ 'password': {'type': 'string'},
+ 'defines': {
+ 'type': 'dict',
+ 'keysrules': {'type': 'string'},
+ 'valuesrules': {'type': ['string', 'integer']}
+ }
}
}
}
diff --git a/include/py/homekit/mqtt/module/ota.py b/include/py/homekit/mqtt/module/ota.py
index cd34332..2f9b216 100644
--- a/include/py/homekit/mqtt/module/ota.py
+++ b/include/py/homekit/mqtt/module/ota.py
@@ -74,4 +74,4 @@ class MqttOtaModule(MqttModule):
if not self._initialized:
self._ota_request = (filename, qos)
else:
- self.do_push_ota(filename, qos)
+ self.do_push_ota(self._mqtt_node_ref.secret, filename, qos)
diff --git a/include/py/homekit/pio/products.py b/include/py/homekit/pio/products.py
index 5b40aae..3d5034f 100644
--- a/include/py/homekit/pio/products.py
+++ b/include/py/homekit/pio/products.py
@@ -41,6 +41,11 @@ def platformio_ini(product_config: dict,
if node_id not in MqttNodesConfig().get_nodes().keys():
raise ValueError(f'node id "{node_id}" is not specified in the config!')
+ try:
+ node_defines = MqttNodesConfig().get_node(node_id)['defines']
+ except KeyError:
+ node_defines = None
+
# defines
defines = {
**product_config['common_defines'],
@@ -66,6 +71,8 @@ def platformio_ini(product_config: dict,
if build_specific_defines:
for k, v in build_specific_defines.items():
defines[k] = v
+ if node_defines:
+ defines = {**defines, **node_defines}
defines = OrderedDict(sorted(defines.items(), key=lambda t: t[0]))
# libs