Was my initial thought as well, to be Z2Mās fault. But after the discussion I think itās a HA problem as well.
Adding a new device to Z2M shows in the logs. It sends the MQTT messages and HAās MQTT integration (core integration) should create the sensors for it.
I just upgraded everything to the latest (HA and all add-ons) versions, deleted the Ikea E1743 from Z2M and HA and restarted HA Core. After this I added the E1743 again. Still no _action
sensorā¦
Anyway, I tried to follow your recommendation and set it up with MQTT directly instead. This is my apps.yaml, which works for the office switch_module, but not for the kitchen LED driver. More details later:
light_kitchen_cupboard_underlight:
module: controllerx
class: E1743Controller
controller: gf_kitchen_cupboard-underlight_switch
integration:
name: z2m
listen_to: mqtt
action_key: action
light: light.gf_kitchen_cupboard-underlight
# light: light.uf_office_light_switch
I tried to set up the light with my ZigBee Gledopto GD-CZ-006 LED strip controller, but couldnāt get it to work.
In Z2M devices.yaml I have configured the controller as light:
'0x00124b0022640d82':
friendly_name: gf_kitchen_cupboard-underlight
homeassistant:
switch:
type: light
object_id: light
light:
name: GF Kitchen Cupboard Underlight
value_template: null
state_value_template: '{{ value_json.state }}'
But when I configure AppDaemon with it, it doesnāt react on button presses. I added a log line in the LightController:
async def call_light_service(self, service: str, **attributes: Any) -> None:
self.log(
f"LightController.call_light_service({service})",
level="WARNING",
ascii_encode=False,
)
I can see, the button press reaches the LightController as I find this in the log:
2022-10-11 16:46:46.091509 INFO light_kitchen_cupboard_underlight: ļæ½ ControllerX v4.23.0
2022-10-11 16:46:46.101936 WARNING light_kitchen_cupboard_underlight: E1743 normal setup
2022-10-11 16:46:46.110154 INFO AppDaemon: App initialization complete
2022-10-11 16:46:52.309171 INFO AppDaemon: New client Heating Settings Dashboard connected
2022-10-11 16:46:57.521330 INFO light_kitchen_cupboard_underlight: ļæ½ Button event triggered: `on`
2022-10-11 16:46:57.523470 INFO light_kitchen_cupboard_underlight: ļæ½ Running `Predefined (on)` now
2022-10-11 16:46:57.525359 WARNING light_kitchen_cupboard_underlight: LightController.call_light_service(light/turn_on)
2022-10-11 16:46:57.527328 INFO light_kitchen_cupboard_underlight:
ļæ½ Service: light.turn_on
- entity_id: light.gf_kitchen_cupboard-underlight
2022-10-11 16:46:57.536208 WARNING HASS: Error calling Home Assistant service default/light/turn_on
2022-10-11 16:46:57.536924 WARNING HASS: Code: 400, error: 400: Bad Request
But obviously it creates an error.
When I set it up with a TuYa TuYa TS0001_switch_module, which is converted to a light as well:
'0xa4c13823592ecc0c':
friendly_name: switch_module.uf_office_light
homeassistant:
switch:
type: light
object_id: light
light:
name: UF Office Light Switch
value_template: null
state_value_template: '{{ value_json.state }}'
I can switch on/off the light with my E1743 without errorsā¦
2022-10-11 16:44:52.304429 INFO light_kitchen_cupboard_underlight: ļæ½ ControllerX v4.23.0
2022-10-11 16:44:52.315251 WARNING light_kitchen_cupboard_underlight: E1743 normal setup
2022-10-11 16:44:52.323353 INFO AppDaemon: App initialization complete
2022-10-11 16:44:59.558926 INFO light_kitchen_cupboard_underlight: ļæ½ Button event triggered: `on`
2022-10-11 16:44:59.561353 INFO light_kitchen_cupboard_underlight: ļæ½ Running `Predefined (on)` now
2022-10-11 16:44:59.563126 WARNING light_kitchen_cupboard_underlight: LightController.call_light_service(light/turn_on)
2022-10-11 16:44:59.565121 INFO light_kitchen_cupboard_underlight:
ļæ½ Service: light.turn_on
- entity_id: light.uf_office_light_switch
Comparing them in Z2M they both expose the state
on/off. And also in the Developer Tools ā States they both have a State on & off.
What might be an indicator: I also added a log statement into the Ikea E1743Controller.get_z2m_actions_mapping(ā¦) and E1743Z2MLightController.get_z2m_actions_mapping(ā¦) functions. It uses the E1743Controller.get_z2m_actions_mapping(ā¦) with my AD configurationā¦
Do you have any recommendation, what I could check to get it up and running?
Thanks in advance!
Best,
Andreas