hass-momentary icon indicating copy to clipboard operation
hass-momentary copied to clipboard

Momentary command line switch

Open SdeGeata opened this issue 4 years ago • 3 comments

Greetings;

I just came upon your momentary switch and have installed and configured it. However, I am not clear on how I actually make the switch trigger things.

My current setup is using various command lines in switches, but inclusion in momentary throws error messages.

For example, from my configuration.yaml:

- platform: momentary name: Increase + mode: on toggle_for: milliseconds: 500 command_on: !secret arizer_increase command_off: !secret arizer_light_off value_template: "{{ value | regex_search('ACTIVE', ignorecase=True) }}"

produces the following error:

Invalid config for [switch.momentary]: [command_on] is an invalid option for [switch.momentary]. Check: switch.momentary->command_on. (See ?, line ?).

SdeGeata avatar Nov 21 '20 22:11 SdeGeata

There is no command_on or command_off option for the momentary switch, it's just a switch.

I you want to run commands you have to monitor the switch from an automation. See Configuration -> Automations -> Add on the GUI.

Set up your trigger to act on a state change on the momentary switch and then run your actions. There are more docs here on automation.

twrecked avatar Nov 22 '20 14:11 twrecked

Ok thanks. I'll try to figure something out along those lines.

SdeGeata avatar Nov 22 '20 22:11 SdeGeata

There is no command_on or command_off option for the momentary switch, it's just a switch.

I you want to run commands you have to monitor the switch from an automation. See Configuration -> Automations -> Add on the GUI.

Set up your trigger to act on a state change on the momentary switch and then run your actions. There are more docs here on automation.

What's a pity, I was also exactly in this case .... why not extend with "command: True" as option ?

SeByDocKy avatar Nov 29 '21 16:11 SeByDocKy