This is awesome, set it up tonight, they are green when my alarm is off and red when my alarm is on, will play to add other things…
I had some weird issues, I was triggering them on alarm_disarmed and “alarm_armed” events, and I had to move the scripts above other calls like locking locks, etc… Or maybe it just doesn’t work sometimes and it’s random? Not sure yet…
Also, I could just test this and will tomorrow, but can you run script with multiple entities or do you need to call it for each zwave entity?
Brand new to HA but have 30some Inovelli switches in the house. This is a known firmware bug with the switches and there’s actually a beta firmware release on their site right now for the red series switch and dimmer that should address this.
Over on Hubitat I went away from using the Inovelli drivers and used a third party one which would allow me to setup automations to modify the default LED colour. So in my case when alarm is armed, default LED colour changes to red, when disarmed default LED colour changes to blue. This would allow it to stay through switch presses or zwave commands but you lose the functionality of blinking/flashing or any of the other notification “animations” there are. Solid colour only. Not sure if anybody has gone down that road yet on HA.
@BrianHanifin, thanks for gathering the relevant Inovelli posts and putting together this script! I have both switches and dimmers and noticed that the effects didn’t work quite right on the switches. In particular the “pulse” effect would just stay solid (I didn’t test the blink effects). It’s possible this is something in my revision of firmware, or with the Inovelli XML files I used to set up my switches and dimmers in Home Assistant. Nobody else seems to be complaining about the switch ‘pulse’ effect not working. Anyway, I have a fix for it.
I also noticed that using the “solid” effect doesn’t make use of the gradient in the LED strip on the dimmer if the lights are <100% power and, if you use the lights the effect is lost and they go back to their default blue. I really wanted to set my LEDs to red and make them dimmer at night, then change them back to some other color and brightness in the day.
I’m happy to share the code, and I can submit a merge request against your git repository if you’re interested.
Based on BrianHanifin’s work I’ve added support for the LZW36 Fan / Light Switch, which has two LED strips. The updated script is backward compatible with old automations, but for the LZW36 it needs either “Type: Fan” or “Type: Light” in order to set the appropriate parameter.
Nice work Kevin! I’ve been away for a bit, but I’m starting to get caught up on what I’ve missed.
I really like the concept of extracting the model from the Product Name attribute. Unfortunately my product_name appears as Unknown: type=0001, id=0001. So, I can’t use that part of your code.
What Zwave integration are you using? I’m using the old default Zwave integration. I have been waiting to try the OpenZwave addon (beta) as I have some complex items to support: smoke detectors, deadbolt, Inovelli dimmer taps and leds…
I also use the open z-wave 1.4 that comes with Home Assistant. Looking forward to 1.6, when that’s ready, but my wife won’t have the patience for anything beta. Inovelli’s config files (and many others, in my experience) aren’t included by default but they’re simple to add. At a high level, you’ll remove the device, add the Inovelli configuration files, and then re-add the switch to the network. It’s a lot of steps, but it isn’t as complicated as it looks. Here’s how I did it (in as much detail as I can muster, in case anybody else needs this too):
You’ll want to jot down the names of your devices and entities so you can use the same names later. That way your automations and templates won’t need to change.
Remove your switches from the z-wave network. It’s the opposite of pairing, if I remember correctly, but check the Inovelli manual for whichever switches you have. The switch, dimmer, fan / light combo switch, and the LED bulb each have a different process.
Get the Inovelli configuration files for your devices from the Inovelli github. Be sure you download the contents of the xml file itself and not the page displaying the xml file, as I’ve done before. I open the file with the “raw” button and copy / paste, but you can also do a git clone of the whole directory.
I’m running Home Assistant in docker and if you’re running core, a VM, or HassIO on a Raspberry Pi the files will be in a different location for you but the rest of the instructions would be the same. In docker, I start a bash session with “docker exec -it hass bash” where hass is the name of my container. From there, I put the files in the directory /usr/local/lib/python3.7/site-packages/python_openzwave/ozw_config/inovelli/ but you might try a “find / -type d -iname ozw_config” to locate it. If you have more than one, I’m not sure how to tell which one Home Assistant is using. Maybe just make the modifications to both?
Next you have to tell open z-wave how to find them and what they are. Open “/usr/local/lib/python3.7/site-packages/python_openzwave/ozw_config/manufacturer_specific.xml” and find the Inovelli section. It’ll look like this:
You want the second Inovelli section; the one with manufacturer ID 031E. The first Inovelli section has ID 0312 and you don’t want that one. The section with ID 031E is probably empty and you need to point it at the configuration files you just added. You should be able to copy and paste these “<product…>” lines, but double check that the file names are right. If you’re adding something in the future that isn’t in this list, you can get the type and id from the .xml file you downloaded.
Add your device back to the z-wave network (see step 2). You should see the make and model for your device once the status is “complete”.
If not, it could be an issue with the xml file, or that the product type or id didn’t match. You’ll have to remove the device from the network and debug from there.
Rename the devices and entities with the originals from step one, and check an automation or two to ensure everything is still working.
Always remember to “heal” your network once you’re done adding all your switches back.
It’s worth noting, for anybody running docker, that every time the container shuts down and restarts these modifications disappear. Your device config and naming persists via a cache in zwcfg_*.xml though. So once you’ve got it added you don’t have to do this again. It’ll still be known to be an LZW31-SN (or whatever). If the container is restarted though, and you want to add a new device, you’ll have to re-do the modifications above. I keep a copy of section 031E in a “z-wave notes.txt” and copies of the xml files in a subdirectory of my hass directory for convenience.
P.S. I was listening to the Home Assistant podcast as I was typing this up, and they specifically mentioned you while discussing the Inovelli switches. If you don’t listen to the podcast regularly, it’s early in the most recent episode. Congratulations!
Thanks for letting me know. I haven’t listened to the new one yet. I like to wait until I’m ready to install the version the episode is about. Right now that means I have to wait for Browser_Mod to be updated so my pop up centric 1-page UI can work with it.
If I can figure out that the new OpenZwave integration supports my deadbolt, smoke alarms, and the Inovelli dimmer, then I will give it a shot soon.
Hey all – thanks so much for all you do – I may not fully understand everything (Eric M. is the Home Assistant guy), but I do regularly read these threads and love seeing what you all can do with these switches.
If you have any questions, I’m here to help – feel free to tag me and if I can’t get an answer, I’ll ask the other Eric!
PS - @kschlichter – if you don’t mind, could I post those instructions in our forum and/or knowledge-base? There’s a lot of people that ask this question.
This exact thing literally works from Developer Tools > Services. When I run it from the automation I get this error in the logs:
Error executing script. Unexpected error for call_service at pos 1: ‘list’ object has no attribute ‘lower’
Traceback in case it helps
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 181, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 373, in _async_call_service_step
await self._async_run_long_action(service_task)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 332, in _async_run_long_action
long_task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1265, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1300, in _execute_service
await handler.func(service_call)
File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 212, in service_handler
await script_entity.async_turn_on(
File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 314, in async_turn_on
await coro
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 764, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 173, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 181, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 342, in _async_call_service_step
domain, service, service_data = async_prepare_call_from_config(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 132, in async_prepare_call_from_config
template.render_complex(config[CONF_SERVICE_DATA_TEMPLATE], variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 73, in render_complex
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 73, in
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 75, in render_complex
return value.async_render(variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 229, in async_render
return compiled.render(kwargs).strip()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 1090, in render
self.environment.handle_exception()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File “/usr/local/lib/python3.8/site-packages/jinja2/_compat.py”, line 28, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py”, line 462, in call
return __context.call(__obj, *args, **kwargs)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 1023, in wrapper
return func(hass, *args[1:], **kwargs)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 671, in state_attr
state_obj = _get_state(hass, entity_id)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 480, in _get_state
state = hass.states.get(entity_id)
File “/usr/src/homeassistant/homeassistant/core.py”, line 900, in get
return self._states.get(entity_id.lower())
AttributeError: ‘list’ object has no attribute ‘lower’
I’m about to be offline, but I can give you two things to try.
1} I think it’s case-sensitive. Make sure you’re matching the case for both the parameter and the value.
Try adding the duration. I think his script uses a default time, but I don’t remember. The way the math works it should still do something (but it’ll be wrong in some way because the calculation is off). Here’s an example from my version. You might want to check it against his though, because I’ve modified it pretty heavily.
Added the duration and capitalized everything like the script expects. I don’t believe it’s actually case sensitive since it works from the developer tools service calls without it.
I suspect that the function trying to find the node_id from the entity_id, when it’s called from an automation, has a bug, or the script is out of date.
When I modify the script to just accept a node_id it works fine from automation screen.