From my 3d printer I have two macros that Klipper esposes as buttons to Home Assistant:
- Hepa Filter ON
- Hepa Filter OFF
Additionally, I have a numeric sensor which maps the state of the pin where the Hepa Filter fan is connected: it goes from zero (off) to 255 (full speed, or whatever).
Thus one can change the status of the fan in several ways: 1- trigger one of the two macros 2- setting the value of the pin.
What I’m trying to achieve is to sum app these elements in a new switch with those behaviours:
1- When turned on, it push the button tied to the Filter On Macro
2- When turned off, it does the same for the Filter Off Macro
3- When one triggers one of the two macro from 3d printer WebUI, it updates its state accordingly
4- When one change the value of the pin from the 3d printer control panel, it updates its state (0 → off; >0 → on)
I create an input_boolean helper (do I need to definea switch in configuration files instead?)
The first two were easy to achieve with this automation:
alias: Qidi Tech - x-smart 3 - AC Filter Control
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.x_smart_3_filtro_ca
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.x_smart_3_filtro_ca
state: "on"
sequence:
- device_id: 3fe374bea764c9f22220effbb43f221a
domain: button
entity_id: 0de8b8b4e0265f75c84754f4af7057b4
type: press
- conditions:
- condition: state
entity_id: input_boolean.x_smart_3_filtro_ca
state: "off"
sequence:
- device_id: 3fe374bea764c9f22220effbb43f221a
domain: button
entity_id: 63652de4877b4ce5c4b71308262d6d9b
type: press
For the remaining parts, The idea was to create another automation with three triggers and a conditional block against which trigger actually fired, to check what actually happened. Then use the switch.turn_on/off services on the helper as action.
…but apparently these services cannot be called from helpers I think I’m missing something here
Said that, I guess this would cause an endless loop. The toggle triggers the macro(s)…which actually update the switch…which triggers the macro(s)…nah, It cannot do the job this way I guess
what am i missing here? ?_?