dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
463 stars 112 forks source link

Maximum devices is somehow connected with maximum number of device types #199

Closed JosefKrieglstein closed 6 months ago

JosefKrieglstein commented 10 months ago

Hi,

its strange behavior but increase maximum number of device types solved my issue, lets try to explain on examples. MEGA2560 (Controllino MEGA), arduino-home-assistant 2.0.0, Could low free RAM ~ 1440 bytes in loop() be an issue?

1# HAMqtt mqtt(mqttclient, device); 6x HASwitch +1x HAFan(HAFan::SpeedsFeature) + 1x HAHVAC(HAHVAC::TargetTemperatureFeature | HAHVAC::PowerFeature) Problem: HVAC data is not published, HVAC config is not published. (HA doesn't detect HAHVAC), HAFan data are published, HAFan config is not published (HA doesn't detect HAFan). I tried also 3x HASwitch+1x HAFan, which also doesn't work. HAFan state Data seems to work correctly. HAFan speed is not working, not published, not subscribed.

2# HAMqtt mqtt(mqttclient, device, 8); ---< increased device types to 8 6x HASwitch + 1x HAFan(HAFan::SpeedsFeature) + 1x HAHVAC(HAHVAC::TargetTemperatureFeature | HAHVAC::PowerFeature) Problem: Problem: HVAC data is not published, HVAC config is not published. (HA doesn't detect HAHVAC), HAFan is detected and working properly. State and also Speed

3# HAMqtt mqtt(mqttclient, device, 10); ---< increased device types to 10 7x HASwitch + 1x HAFan(HAFan::SpeedsFeature) + 1x HAHVAC(HAHVAC::TargetTemperatureFeature | HAHVAC::PowerFeature) No problem, all devices working properly

I'm using 3 device types, Do I understand wrong documentation about "number of Device Types" ? But why data of state are published and config and speed not? I'm looking with MQTT explorer to check if config is published or not, looking into DataPrefix and DiscoveryPrefix path for data and config.

BR Josef

dawidchyrzynski commented 6 months ago

Hi @JosefKrieglstein,

The device type essentially corresponds to the number of instances you create. There is a known bug in the library that necessitates setting the number of devices to be one more than the devices you actually register. This is the reason the third solution proves effective.