Skip to content

Commit

Permalink
mathieucarbou/MycilaHADiscovery @ 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jun 7, 2024
1 parent 764346f commit fe8f4a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ lib_deps =
mathieucarbou/MycilaDS18 @ 2.0.1
mathieucarbou/MycilaESPConnect @ 4.3.1
mathieucarbou/MycilaEasyDisplay @ 3.0.1
mathieucarbou/MycilaHADiscovery @ 2.1.1
mathieucarbou/MycilaHADiscovery @ 2.2.0
mathieucarbou/MycilaJSY @ 9.0.0
mathieucarbou/MycilaLogger @ 3.1.2
mathieucarbou/MycilaMQTT @ 4.1.1
Expand Down
1 change: 1 addition & 0 deletions src/init/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Mycila::Task initConfigTask("Init Config", [](void* params) {
haDiscovery.setDiscoveryTopic(config.get(KEY_HA_DISCOVERY_TOPIC));
haDiscovery.setBaseTopic(config.get(KEY_MQTT_TOPIC));
haDiscovery.setWillTopic(config.get(KEY_MQTT_TOPIC) + YASOLR_MQTT_WILL_TOPIC);
haDiscovery.setBufferSise(512);
haDiscovery.setDevice({
.id = Mycila::AppInfo.defaultMqttClientId,
.name = Mycila::AppInfo.defaultSSID,
Expand Down
3 changes: 3 additions & 0 deletions src/tasks/HADiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Mycila::Task haDiscoveryTask("HADiscovery", Mycila::TaskType::ONCE, [](void* params) {
logger.info("YASOLR", "Publishing Home Assistant Discovery configuration...");
haDiscovery.begin();

// DIAGNOSTIC

Expand Down Expand Up @@ -77,4 +78,6 @@ Mycila::Task haDiscoveryTask("HADiscovery", Mycila::TaskType::ONCE, [](void* par
haDiscovery.publish(Mycila::HACounter("output2_relay_switch_count", "Output 2 Bypass Relay Switch Count", "/router/output2/relay/switch_count", nullptr, "mdi:counter"));
haDiscovery.publish(Mycila::HAOutlet("output2_relay", "Output 2 Bypass", "/router/output2/bypass/state/set", "/router/output2/bypass/state", YASOLR_ON, YASOLR_OFF));
haDiscovery.publish(Mycila::HAGauge("output2_temperature", "Output 2 Temperature", "/router/output2/temperature", "temperature", "mdi:thermometer", "°C"));

haDiscovery.end();
});

0 comments on commit fe8f4a3

Please sign in to comment.