Closed effelle closed 5 years ago
@arendst, I've found the issue.
Buttons and switches are not created when using the default switchtopic
/ buttontopic
.
Just set them with any other value than 0
and the entities will be created as expected:
16:01:57 CMD: backlog switchtopic; buttontopic; gpio;
16:01:57 MQT: HA_DEV7/stat/RESULT = {"SwitchTopic":"HA_DEV7"}
16:01:57 MQT: HA_DEV7/stat/RESULT = {"ButtonTopic":"HA_DEV7"}
16:01:57 MQT: HA_DEV7/stat/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"17":"Button1"},"GPIO5":{"18":"Button2"},"GPIO12":{"9":"Switch1"},"GPIO13":{"10":"Switch2"},"GPIO14":{"11":"Switch3"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"}}
16:02:01 CMD: setoption19 1
16:02:01 MQT: HA_DEV7/stat/RESULT = {"SetOption19":"ON"}
16:02:01 MQT: homeassistant/light/471078_LI_1/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_1/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_2/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_2/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_3/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_3/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_4/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_4/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_5/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_5/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_6/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_6/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_7/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_7/config = (retained)
16:02:01 MQT: homeassistant/light/471078_LI_8/config = (retained)
16:02:01 MQT: homeassistant/switch/471078_RL_8/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_BTN_1/config = {"name":"HA_DEV7 BTN","stat_t":"~cmnd/POWER","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"471078_BTN_1","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]]},"~":"HA_DEV7/","frc_upd":true,"pl_off":"OFF"} (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_BTN_2/config = {"name":"Sonoff2 BTN","stat_t":"~cmnd/POWER","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"471078_BTN_2","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]]},"~":"HA_DEV7/","frc_upd":true,"pl_off":"OFF"} (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_BTN_3/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_BTN_4/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_1/config = {"name":"HA_DEV7 SW","stat_t":"~cmnd/POWER","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"471078_SW_1","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]]},"~":"HA_DEV7/","frc_upd":true,"pl_off":"OFF"} (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_2/config = {"name":"Sonoff2 SW","stat_t":"~cmnd/POWER","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"471078_SW_2","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]]},"~":"HA_DEV7/","frc_upd":true,"pl_off":"OFF"} (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_3/config = {"name":"Sonoff3 SW","stat_t":"~cmnd/POWER","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"471078_SW_3","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]]},"~":"HA_DEV7/","frc_upd":true,"pl_off":"OFF"} (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_4/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_5/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_6/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_7/config = (retained)
16:02:01 MQT: homeassistant/binary_sensor/471078_SW_8/config = (retained)
16:02:01 MQT: homeassistant/sensor/471078_status/config = {"name":"HA_DEV7 status","stat_t":"~HASS_STATE","avty_t":"~LWT","pl_avail":"Online","pl_not_avail":"Offline","json_attributes_topic":"~HASS_STATE","unit_of_meas":" ","val_tpl":"{{value_json['RSSI']}}","uniq_id":"471078_status","device":{"identifiers":["471078"],"connections":[["mac","CC:50:E3:47:10:78"]],"name":"HA_DEV7","model":"Generic","sw_version":"6.6.0.14(sonoff)","manufacturer":"Tasmota"},"~":"HA_DEV7/tele/"} (retained))
However, this will create issues with normal behavior.
Now, my question: is there a real interest on HA integration? I know you don't like it much and I can't blame you for that in some way, but we have the possibility to transform it in a fully functional tool for BOTH Home Assistant and OpenHab, since the latter can now identify MQTT device with HA format, even if some adjustment are needed for JsonPath.
I know the code size and ram usage are an issue, then how about start to think to remove it form the main .bins to free space for more interesting stuff and create another firmware sonoff-ha.bin?
@meingraham @ascillato2 @Jason2866 @jziolkowski what are your thoughts?
As there is a important number of users that have Home Assistant as its home automation software, I don't think to be a good idea to disable it by default.
I think if there are new features that begin to push against the flash and iRAM limits of the ESP82xx, then HA could be considered a "user option". We can consider providing "pre-made" user_config_override.h
for HA users to easily compile using Gitpod... or, now that @andrethomas has optimized firmware compilation using PlatfromIO caching on thehackbox, add another branch of binary variants for HA. When 2.6 comes out, there may be an opportunity to have HA variants which are only 2.6. If users want HA on another core, they can compile themselves.
It's important to recognise that the firmware capabilities are expanding in different directions at the same time and that the time of having a sonoff.bin "one fits all solution" is not going to be possible in the not so distant future.
To me, its not just about HA vs. Non-HA support but also that we're adding drivers for chips which will never be connected to let's say a tuya based light bulb and as nice as it might be to have an LM75AD I2C temperature sensor inside the bulb it's not going to be a very likely combination.
I don't mind adding additional variants but it should be planned carefully otherwise choosing a binary will need a wizard form of some sort on its own... which of course is not ideal.
I like Mike's idea and Andre has a strong point. Tasmota is growing with an impressive pace.
BUG DESCRIPTION
As per Wiki, Home Assistant discovery should create button and switches under
/binary_sensor/%s/config
automatically, independently by the presence of a relay. Actually the switches and buttons aren't created at all. As a first inspection using someAddLog(LOG_LEVEL_DEBUG)
, seemsvoid HAssAnnounceButtonSwitch()
is never reached even ifvoid HAssAnnounceSwitches(void)
andvoid HAssAnnounceButtons(void)
are. A more simple setup like switch1/relay1 will show the same issue: just the relay will be sent to Home Assistant.REQUESTED INFORMATION
Backlog Template; Module; GPIO
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog 4
for more debug information)TO REPRODUCE
Setup a device with just swithces and buttons and enable
setoption19
.EXPECTED BEHAVIOUR
All the switches and buttons should be created on Home Assistant as
binary_sensor
.