Switches changes not supposed to

Alright, so we all hear about the danger having our phone, tablet etc. chargers connected all the time?
How do we solve this with a bit of code and a power switch? (in my case a z-wave connected to vera) So the chargers only work when needed.
I’ve gathered chargers for my familys ipads, android tablets och the childrens phones in a power strip that is connected through the z-wave switch.

I added this code into automations, making it start/check every 30minutes, and when power consumption is below 5W it turns itself off.
My issue using this code is that Hassio (latest) toggles all available switches on or off, not only the one supposed to.
Could anyone see what I am not seeing here please?

- action:
  - entity_id: switch.laddare_52
    service: switch.turn_on
  alias: Laddare Kontroll/ON
  condition: []
  id: '1521555105142'
  trigger:
  - platform: time
    minutes: /30
    seconds: 0
- action:
  - entity_id: switch.laddare_52
    service: switch.turn_off
  alias: Laddare OFF
  condition: []
  id: '1521555137267'
  trigger:
  - platform: template
    value_template: '{{ states.switch.laddare_52.attributes.current_power_w < 5 }}'

That’s not what those automations are doing.

You have 2 automations there.

One monitors the power consumption every time it changes, and if it is below 5 switches it off (which is probably what you want).

The other switches it all back ON every 30 minutes.

yes, thats what it supposed to do.
Basically it does a check if new hardware needs to be charged every 30minutes, if needed the power consumption gets above 5W, if not it will turn off.

But those automations triggers all my switches on/off at the same time.

In that case, with the sincerest of apologies, I don’t know what you’re asking for help with?

Sorry if being unclear, but Hassio operates all my switches with those automations, and thats my problem :slight_smile:
All switches is being triggered and not just the one that I’ve stated into entity_id

What, like all your other switches? Or just Zwave?

Possibly you have a Zwave association between the devices, causes Zwave devices to operate in a ‘default’ mode without the intervention of the controller (so like associate a motion sensor with a light and it will turn it on when there is movement without any automation rules needed).

I have another Z-Wave power switch to my TV,
and two z-wave sensors on two doors (seen in HA as switches)

Those are all beeing triggered when my automation above runs.
i have no other switches installed yet.

Vera is used only as interface between hassio and z-wave so nothing is set there, and I havent set any other association between all those devices neither.

Seems to me that Hassio somehow triggers all switches instead of trigger only “switch.laddare_52”

Neither did this guy…

https://community.home-assistant.io/t/mysterious-associations-that-i-dont-remember-setting-up/

Definitely worth looking into. I can’t see why homeassistant would ignore the entity id.

I will look into it this evening when getting home from work.
Recently I had this switch for a lamp in my bedroom, but found out it could get to better use :wink:
As switch for the lamp I had no trouble with it activating other units, but ofc I had it customized to be a light instead of a switch, if that makes any differense.
Its now with this new automations and as a switch the trouble began.

Okey, tried a bit more and changing the switch manually in Hassio frontend doesn’t change the others.
So there isn’t any associations as they would trigger also with a manual change of state.
So I would guess that there is something else that’s wrong :thinking: