Start automation with scene id and stop with another and slowly dim?

I have a ZME_WALLC-S Z-Wave remote/switch that sends scene id when pushing buttons.

It sends id 11 if pressing button up and id 12 if pressing button down.
when holding the button up it sends id 13 and when releasing the button it sends id 14.
and for down it sends 15 when start holding and 16 when releasing.

I wonder is it possible to start an automation with one scene id (in this case 13 or 15)
and the automation should then be that it slowly increase/decrease the value for brightness and then stop the automation with another scene id (in this case 14 or 16)?

After the chat on Discord, I think this should be possible with AppDaemon. It’s theoretically doable with a script, but it’ll be as pretty as a bulldog chewing a wasp…

I think the way it would work would be that you start a process that slowly dims the light until minimum brightness (varies from light to light, but say 5) and then increases the brightness to max, and repeats that until stopped. You trigger it with one scene, and stop it with the other.

Maybe I’ve worked out a way of doing it without AppDaemon (though I’m still sure AppDaemon will be cleaner).

None of these are tested, and I’m sure there’s better ways of doing this. Maybe they’ll get you (or anybody else) moving in the right direction.

you asked “What’s the entity id of the remote?”

entity_id: zwave.zwaveme_zme_wallcs_secure_wall_controller_1

for dim up, scene_id: 13 when the button i pushed and scene_id: 14 when the button is released
for dim down, scene_id: 15 when the button i pushed and scene_id: 16 when the button is released

Ah, that’ll make it simpler - it’d be a pair of scripts, one for up and one for down.

First though, it’ll be worth seeing whether what I pulled together works at all (changing the entity_id in the automation to match what you posted). I’ve just roughed these out after all.

does all go in configuration.yaml file (if I havn’t made any files)?

In the relevant sections, yes. You’ll need to put:

script:

Before the scripts, and add 2 spaces at the start of the lines.

When I restart Hass I get an error log and this is what it say, I have also included what I have put in the configuration.yaml file (including row numbers in front.

error on line 143 is just a missing : but the error on line 158 is harder for me to under stand

Sep 03 15:01:07 hass.local systemd[1]: Started Home Assistant.
Sep 03 15:01:12 hass.local hass[29382]: 2017-09-03 15:01:12 ERROR (Thread-2) [homeassistant.util.yaml] while scanning a simple key
Sep 03 15:01:12 hass.local hass[29382]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 143, column 9
Sep 03 15:01:12 hass.local hass[29382]: could not find expected ‘:’
Sep 03 15:01:12 hass.local hass[29382]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 158, column 5
Sep 03 15:01:12 hass.local hass[29382]: 2017-09-03 15:01:12 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while scan… a simple key
Sep 03 15:01:12 hass.local hass[29382]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 143, column 9
Sep 03 15:01:12 hass.local hass[29382]: could not find expected ‘:’
Sep 03 15:01:12 hass.local hass[29382]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 158, column 5
Sep 03 15:01:12 hass.local hass[29382]: Config directory: /home/homeassistant/.homeassistant
Hint: Some lines were ellipsized, use -l to show in full.

137 script:
138 light_dim_bright:
139 sequence:
140 - service: light.turn_on
141 data_template:
142 entity_id: light.YOURLIGHT
143 brightness >
144 {% set current = states.light.YOURLIGHT.attributes.brightness | int %}
145 {% set step = 1 %}
146 {% if states.input_select.light_direction.state == bright %}
147 {% set next = current + step %}
148 {% if next > 99 %}
149 {% set next = 100 %}
150 {% endif %}
151 {% else %}
152 {% set next = current - step %}
153 {% if next < 5 %}
154 {% set next = 5 %}
155 {% endif %}
156 {% endif %}
157
158 - service: input_select.select_option
159 data_template:
160 entity_id: input_select.light_direction
161 option: <
162 {% if states.light.YOURLIGHT.attributes.brightness == 100 %}
163 dim
164 {% elif states.light.YOURLIGHT.attributes.brightness == 5 %}
165 bright
166 {% else %}
167 {{ states.input_select.light_direction.state }}
168 {% endif %}
169
170 - service: script.turn_on
171 data:
172 entity_id: script.light_dim_bright_pause
173
174 light_dim_bright_pause:
175 sequence:
176 - delay:
177 milliseconds: 10
178 - service: script.turn_on
179 data:
180 entity_id: script.light_dim_bright

Don’t include the line numbers when you copy things over :wink:

You may also want to read the troubleshooting steps, since that’ll save you a lot of time by validating your config.

If you’re unsure, remove any passwords etc and put your config up on hastebin or similar.

I fixed so the Hass can start now, but when I open Hass webui I get this error message on the first screen.

Invalid Config

The following components and platforms could not be set up:

* action
* lightdimbright_pause
* initial_state
* trigger
* lightdimbright
* alias

Please check your config
Dismiss

I have run the configuration.yaml, in Yamllintand it was OK

this is how my configyration.yaml looks like.
https://hastebin.com/ocecomekoh.rb

Can you see what the problem is?

Your formatting was quite wrong. Try https://hastebin.com/ozivabowuk.rb

OK, changed now to (same config that you sent me) https://hastebin.com/edusepodaw.rb

now I get this error message
2017-09-03 22:50:33 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17
2017-09-03 22:50:33 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17
pi@hass:/home/homeassistant/.homeassistant$ tail -f home-assistant.log
2017-09-03 22:50:33 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17
2017-09-03 22:50:33 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17

Part of the issue may be that you’ve not replaced light.YOURLIGHT with the actual entity ID.

Not sure though.

changed to the wifi light but still get this…

Sep 03 23:17:49 hass.berli.se systemd[1]: Started Home Assistant.
Sep 03 23:17:53 hass.berli.se hass[31096]: 2017-09-03 23:17:53 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
Sep 03 23:17:53 hass.berli.se hass[31096]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17
Sep 03 23:17:53 hass.berli.se hass[31096]: 2017-09-03 23:17:53 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping va… allowed here
Sep 03 23:17:53 hass.berli.se hass[31096]: in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 17
Sep 03 23:17:53 hass.berli.se hass[31096]: Config directory: /home/homeassistant/.homeassistant

I have looked around and can’t get it it right, this is what I see in the log

2017-09-04 07:12:06 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 19
2017-09-04 07:12:06 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 115, column 19

and here’s how my config looks like
https://hastebin.com/otilomacur.rb

Would be lovely if someone could help me out here.

Look att row 114 instead…
and compare it to line 127

That might be the cause.

Yes that fixed that error message, now it’s a script error. @Tinkerer maybe you can have a look now at the script you helped me with

Now it gives me this error message in the logfile
2017-09-04 07:57:21 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: expected a dictionary for dictionary value @ data[‘script’]. Got [OrderedDict([(‘light_dim_bright’, None), (‘sequence’, [OrderedDict([(‘service’, ‘light.turn_on’), (‘data_template’, OrderedDict([(‘entity_id’, ‘light.yeelight_rgb_34ce00800ae4’), (‘brightness’, '{% set current = states.light.yeelight_rgb_34ce00800ae4.attributes.brightness | int %} {% set step = 1 %} {% if states.input_select.light_direction.state == bright %} \n {% set next = current + step %}\n {% if next > 99 %}\n {% set next = 100 %}\n {% endif %}\n{% else %}\n {% set next = curren… (See /home/homeassistant/.homeassistant/configuration.yaml, line 140). Please check the docs at https://home-assistant.io/components/script/
2017-09-04 07:57:21 ERROR (MainThread) [homeassistant.setup] Setup failed for script: Invalid config.

This is how the config looks like now.

https://hastebin.com/yicolohoro.rb

Hey!

From a quick skim of the Discord chat somebody else spotted my inability to rough Yaml on the fly, and I think you’re good? If not, just shout!

yes, it starts now but the script seems not to work.

when I hold the button on the remote I can see that the script starts, the switch for the script in Hass turns on when I hold and turns off when I release.

This is what I get in the logs
2017-09-04 19:55:42 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: expected int for dictionary value @ data[‘brightness’]. Got ‘’
2017-09-04 19:55:42 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: < dim (possible options: bright, dim)
2017-09-04 19:55:42 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: expected int for dictionary value @ data[‘brightness’]. Got ‘’
2017-09-04 19:55:42 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: < dim (possible options: bright, dim)
~

and this is how my config looks like now.
https://hastebin.com/eyelucelop.rb

For anybody else following along, after much back and fore on Discord we ended up with a working script combination, nothing as fancy as AppDaemon:

1 Like