All Lights Off (Home Assistant)?

I’m still wrapping my head around Home Assistant and unclear on a few things (go easy on me!)

What I’m trying to accomplish:

  • I have a house full of Inovelli switches and dimmers (>30)
  • I want to setup a way to turn all lights off (almost all, I may leave the exterior ones on)
  • I’d like to execute this by triple tap down on a select few switches/dimmers
  • I’d also love to expand this to close garage doors and lock doors (but that’s out of scope obviously)

I found blueprints for the dimmer and the switch, but it’s unclear to me how I use them and combine them together?

Any pointers would be greatly appreciated.

Once your zwave lights are added to Home Assistant they are the same as any other light. There is nothing special about Inovelli light dimmers (well, yes there is - they rock!) for what you’d like to do other than triggering your automation which will look something like this.

- id: zwave_side_entrance_light_3D
  alias: '[ZWave] Side Entrance Light 3D'
  description: 'Respond to light switch 3X down command.'
  max_exceeded: silent
  trigger:
    - platform: event
      event_type: zwave_js_value_notification
      event_data:
        value: KeyPressed3x
        property_key_name: '001'
  condition: "{{ trigger.event.data['node_id'] == 35 }}"
  action:
    - service: light.turn_off
      target:
        entity_id: all

    - service: cover.close
      target:
        entity_id: cover.garage_door

    - service: lock.lock
      target:
        entity_id: all

property_key_name: ‘001’ is down, property_key_name: ‘002’ is up

BTW you’ll have much better luck getting your Home Assistant specific questions answered on the Home Assistant Community Forum. There are many threads on this very topic.

Thanks…I’ll start posting these (although I’ve found this group to be incredibly helpful).

One quick questions on this:

What is the condition you have listed here? Is that the id for the specific switch that this is programmed to?

Yes, you are telling the automation to respond to only the desired node. 35 is the node_id for the light.side_entrance_light entity in this case.

The Device ID in the device configuration is the same as the node id.

image

Use Light Groups and then call a script to turn the lights off. That is my method and it works GREAT.

You can also use zwavejs multicast, and it is more instant but also more complicated.

2 Likes

Thanks…I’ll try and take a look at both methods. I don’t want it to be all lights (I’ll want to keep exterior on), so maybe light groups is the right option.

1 Like

multicast is great, but since parameters are different between switches and dimmers, if you have multiple types then you need to make multiple multicast calls. Kind of the only downside to it.

My one big piece of advice here is to not send a mass “off” command out to 30+ devices. That creates a bunch of traffic and will slow things down. Implement a check first to see which devices are on and only send it to those devices. Both ways work, but if there’s only 5 that needs turning off it’ll be a whole lot faster to only send to those 5 and not all 30. I know how to do it in node-red, but can’t help you in yaml.

1 Like

Please share NR! Very interested.

Also very interested in the NR example…I need to clean up my ‘goodnight’ automation as it’s taking noticeably longer than it used to and this would help significantly.

Something I have struggled with is building arrays and issuing commands to them (either via single or multi-cast). I’d love something where I can start with all inovelli, then narrows by model type, and then status, and build an array to issue commands. I’m sure it’s possible!

Edit: I played with this over lunch and can use the ENTITY properties to filter down to an array of, for example, lights that are on, but I can’t find a way to get DEVICE properties like manufacturer or model. I’m sure someone around here has that understanding, but as of right now I’m at a standstill until I can get DEVICE properties into NR.

1 Like

The trigger is looking for every 3X down keypresses from every device then the condition stops the automation unless it’s the device wanted. It’s also possible to put the node id into the event data as well and skip the condition so the automation only fires with a 3X down press on the single device.

Of course, you could also remove that condition and then a 3X down press on any device would activate the automation or put multiple nodes in there to use a few devices.

Here you go gentlemen. Import this flow and change the details to match your setup and you’re all set.

First you need to create a group of all your lights. I called mine group.goodnight_lights

The get entities node checks every entity in the group to match what state you choose. So in this case, the “on” state.

It then outputs the matching entities into a join node where it creates a string. light.kitchen, light.bedroom, light.living_room etc…

And then it uses that string to send the off commands to the lights.

You can use this for locks, covers, media_players. Essentially any group of entity and only send the command to the ones that need it, drastically reducing traffic on the network and making everything so much faster.

[{"id":"393e066b.78413a","type":"ha-get-entities","z":"a8efc4c6.6fe918","name":"Which Lights?","server":"94fdcfdf.a00b","version":0,"rules":[{"property":"entity_id","logic":"in_group","value":"group.goodnight_lights","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":400,"y":260,"wires":[["bef4604a.81564"]]},{"id":"bef4604a.81564","type":"template","z":"a8efc4c6.6fe918","name":"Format Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.entity_id}}","output":"str","x":610,"y":260,"wires":[["46e1c983.10f708"]]},{"id":"46e1c983.10f708","type":"join","z":"a8efc4c6.6fe918","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":260,"wires":[["7d9b910b.9eee2"]]},{"id":"7d9b910b.9eee2","type":"api-call-service","z":"a8efc4c6.6fe918","name":"Turn Off Lights","server":"94fdcfdf.a00b","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"{\"entity_id\":\"{{payload}}\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":900,"y":260,"wires":[[]]},{"id":"94fdcfdf.a00b","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

And if you’re looking to trigger this from an Inovelli device, add this to your pallet in node-red.
node-red-contrib-ha-inovelli-manager (node) - Node-RED (nodered.org)
The scene manager node has all the possible click configurations already setup for you so you just need to run your zwavejs event into it and then select the right output based on how many clicks up or down.

3 Likes

This can’t be right, it’s 4 nodes and looks way simpler than anything I anticipated.

Thanks! :slight_smile:

LOL I find most things in NR are much simpler than trying to do it all with YAML.

I use the get entities node all over the place for more than just lights. Door/Window left open, turn off heat and send notification with list of doors/windows that are open. Determine who came home/left and have alexa play a random welcome/goodbye message. Once you get the basics of it, it becomes one of the most useful nodes in the pallet.

1 Like

This is a lot clearer on what to do. Also I totally forgot about needing to make a specific group…I’d managed to figure out I wanted the get entities node, but I was getting way more or less than I actually wanted and then wasn’t formatting it right :slight_smile:

Edit - I spoke too soon, it’s not finding anything in my groups, now to figure that out.
Edit 2 - Needed to remove your Home Assistant Global node that’s named exactly the same as mine :slight_smile: and now it’s super fast!

So there is no way to get HA to automatically incorporate Inovelli LZW31-SN’s into an array? I thought @harjms or someone was automatically setting parameters for switches that were added based on device components.

Thanks for the flow, I like where this is heading.

Probably not James, he is on Hubitat.

Do you mean this?

That sounds like this from zwavejs2mqtt

2 Likes

The easiest way (and the method I use) is to assign custom attributes to your light entities and then template against those attributes.

Here’s an excerpt from my config where I assign the attributes.

homeassistant:
  customize:
    light.back_yard_garden_light:
      type: switch

    light.kitchen_sink_light:
      type: switch

    light.back_house_potlights:
      type: dimmer
      notify_led: true
      led_alarm: true
      led_garage: true
      led_scene: true

    light.back_yard_tree_lights:
      type: dimmer

And this is an example template that would list all dimmer lights.

{{ states.light|selectattr('attributes.type','eq','dimmer')|map(attribute='entity_id')|list }}

image

You can make these attributes pretty much anything you want and you can do this for any entity, not just lights.

2 Likes