Automation + mysensor

Hi,

I try to make some simple automation and it doesn’t work at all.
I try lot of other things to make it to work, but nothing…

please help me .

automation.yaml:

`
automation:

  • alias: ‘Lumiere_salon’
    trigger:
    • plateforme: state
      entity_id: binary_sensor.bouton_salon_19_0
      condition:
    • plateforme: state
      entity_id: binary_sensor.bouton_salon_19_0
      state: off
      action:
      service: switch.toggle
      entity_id: switch.prise_10_2

`

configuration.yaml:
`

CONFIGURATION

GENERAL

homeassistant:
name: Home
latitude: xxxxxxxx
longitude: xxxxxxxxxx
unit_system: metric
elevation: 151
time_zone: Europe/Paris
customize: !include customize.yaml

INCLUDE

Devices

#switch: !include devices/switches.yaml
sensor: !include devices/sensors.yaml

#media_player: !include devices/media_players.yaml
#camera: !include devices/cameras.yaml

Inputs

#input_select: !include inputs/input_select.yaml
#input_slider: !include inputs/input_slider.yaml

Web Links

weblink: !include web_links.yaml

Shell Commands

#shell_command: !include shell_commands.yaml

Scripts

#script: !include scripts.yaml

Groups

group: !include groups.yaml

Automation

automation: !include automation.yaml

ACTIVATE

history:
frontend:

View all events in a logbook

logger:

default: info

logs:

homeassistant.components: info

mysensors:
gateways:

  • device: ‘COM4’
    persistence_file: ‘C:/Users/Fabien/AppData/Roaming/.homeassistant/mysensors.json’
    baud_rate: 115200
    debug: true
    persistence: true
    version: ‘1.5’
    optimistic: ‘true’
    `

log file:
16-08-24 20:26:51 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sensor.chambre_1_0, new_state=<state sensor.chambre_1_0=46.4; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.4, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:26:51.815031+02:00>, old_state=<state sensor.chambre_1_0=46.7; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.7, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:25:51.799440+02:00>> 16-08-24 20:26:51 homeassistant.components.mysensors: Chambre 1 1: value_type 0, value = 33.3 16-08-24 20:26:51 homeassistant.components.api: STREAM 7571184 FORWARDING <Event state_changed[L]: entity_id=sensor.chambre_1_0, new_state=<state sensor.chambre_1_0=46.4; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.4, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:26:51.815031+02:00>, old_state=<state sensor.chambre_1_0=46.7; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.7, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:25:51.799440+02:00>> 16-08-24 20:26:51 homeassistant.components.api: STREAM 7570808 FORWARDING <Event state_changed[L]: entity_id=sensor.chambre_1_0, new_state=<state sensor.chambre_1_0=46.4; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.4, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:26:51.815031+02:00>, old_state=<state sensor.chambre_1_0=46.7; battery_level=0, node_id=1, device=COM4, icon=mdi:water-percent, child_id=0, V_HUM=46.7, friendly_name=Chambre, unit_of_measurement=% @ 2016-08-24T20:25:51.799440+02:00>> 16-08-24 20:26:51 homeassistant.components.api: STREAM 7571184 WRITING data: {"event_type": "state_changed", "origin": "LOCAL", "time_fired": "2016-08-24T18:26:51.815031+00:00", "data": {"entity_id": "sensor.chambre_1_0", "new_state": {"state": "46.4", "last_changed": "2016-08-24T18:26:51.815031+00:00", "entity_id": "sensor.chambre_1_0", "last_updated": "2016-08-24T18:26:51.815031+00:00", "attributes": {"battery_level": 0, "node_id": 1, "device": "COM4", "unit_of_measurement": "%", "child_id": 0, "icon": "mdi:water-percent", "friendly_name": "Chambre", "V_HUM": "46.4"}}, "old_state": {"state": "46.7", "last_changed": "2016-08-24T18:25:51.799440+00:00", "entity_id": "sensor.chambre_1_0", "last_updated": "2016-08-24T18:25:51.799440+00:00", "attributes": {"battery_level": 0, "node_id": 1, "device": "COM4", "unit_of_measurement": "%", "child_id": 0, "icon": "mdi:water-percent", "friendly_name": "Chambre", "V_HUM": "46.7"}}}} 16-08-24 20:26:52 homeassistant.components.api: STREAM 7570808 WRITING data: {"event_type": "state_changed", "origin": "LOCAL", "time_fired": "2016-08-24T18:26:51.815031+00:00", "data": {"entity_id": "sensor.chambre_1_0", "new_state": {"state": "46.4", "last_changed": "2016-08-24T18:26:51.815031+00:00", "entity_id": "sensor.chambre_1_0", "last_updated": "2016-08-24T18:26:51.815031+00:00", "attributes": {"battery_level": 0, "node_id": 1, "device": "COM4", "unit_of_measurement": "%", "child_id": 0, "icon": "mdi:water-percent", "friendly_name": "Chambre", "V_HUM": "46.4"}}, "old_state": {"state": "46.7", "last_changed": "2016-08-24T18:25:51.799440+00:00", "entity_id": "sensor.chambre_1_0", "last_updated": "2016-08-24T18:25:51.799440+00:00", "attributes": {"battery_level": 0, "node_id": 1, "device": "COM4", "unit_of_measurement": "%", "child_id": 0, "icon": "mdi:water-percent", "friendly_name": "Chambre", "V_HUM": "46.7"}}}} 16-08-24 20:26:53 mysensors.mysensors: n:0 c:0 t:3 s:9 p:read: 16-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:30.6 16-08-24 20:26:53 homeassistant.components.mysensors: update sensor_update: node 16 16-08-24 20:26:53 homeassistant.components.mysensors: Sonde Salon 16 0: value_type 1, value = 1.0 16-08-24 20:26:53 homeassistant.components.mysensors: Sonde Salon 16 1: value_type 0, value = 30.6 16-08-24 20:26:53 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sensor.sonde_salon_16_1, new_state=<state sensor.sonde_salon_16_1=30.6; battery_level=0, node_id=16, V_TEMP=30.6, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:26:53.127530+02:00>, old_state=<state sensor.sonde_salon_16_1=30.5; battery_level=0, node_id=16, V_TEMP=30.5, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:25:53.127578+02:00>> 16-08-24 20:26:53 homeassistant.components.api: STREAM 7571184 FORWARDING <Event state_changed[L]: entity_id=sensor.sonde_salon_16_1, new_state=<state sensor.sonde_salon_16_1=30.6; battery_level=0, node_id=16, V_TEMP=30.6, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:26:53.127530+02:00>, old_state=<state sensor.sonde_salon_16_1=30.5; battery_level=0, node_id=16, V_TEMP=30.5, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:25:53.127578+02:00>> 16-08-24 20:26:53 homeassistant.components.api: STREAM 7570808 FORWARDING <Event state_changed[L]: entity_id=sensor.sonde_salon_16_1, new_state=<state sensor.sonde_salon_16_1=30.6; battery_level=0, node_id=16, V_TEMP=30.6, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:26:53.127530+02:00>, old_state=<state sensor.sonde_salon_16_1=30.5; battery_level=0, node_id=16, V_TEMP=30.5, device=COM4, child_id=1, friendly_name=Salon, unit_of_measurement=°C @ 2016-08-24T20:25:53.127578+02:00>> 16-08-24 20:26:53 homeassistant.components.api: STREAM 7571184 WRITING data: {"event_type": "state_changed", "origin": "LOCAL", "time_fired": "2016-08-24T18:26:53.127530+00:00", "data": {"entity_id": "sensor.sonde_salon_16_1", "new_state": {"state": "30.6", "last_changed": "2016-08-24T18:26:53.127530+00:00", "entity_id": "sensor.sonde_salon_16_1", "last_updated": "2016-08-24T18:26:53.127530+00:00", "attributes": {"battery_level": 0, "node_id": 16, "V_TEMP": "30.6", "device": "COM4", "child_id": 1, "friendly_name": "Salon", "unit_of_measurement": "\u00b0C"}}, "old_state": {"state": "30.5", "last_changed": "2016-08-24T18:25:53.127578+00:00", "entity_id": "sensor.sonde_salon_16_1", "last_updated": "2016-08-24T18:25:53.127578+00:00", "attributes": {"battery_level": 0, "node_id": 16, "V_TEMP": "30.5", "device": "COM4", "child_id": 1, "friendly_name": "Salon", "unit_of_measurement": "\u00b0C"}}}} 16-08-24 20:26:53 homeassistant.components.api: STREAM 7570808 WRITING data: {"event_type": "state_changed", "origin": "LOCAL", "time_fired": "2016-08-24T18:26:53.127530+00:00", "data": {"entity_id": "sensor.sonde_salon_16_1", "new_state": {"state": "30.6", "last_changed": "2016-08-24T18:26:53.127530+00:00", "entity_id": "sensor.sonde_salon_16_1", "last_updated": "2016-08-24T18:26:53.127530+00:00", "attributes": {"battery_level": 0, "node_id": 16, "V_TEMP": "30.6", "device": "COM4", "child_id": 1, "friendly_name": "Salon", "unit_of_measurement": "\u00b0C"}}, "old_state": {"state": "30.5", "last_changed": "2016-08-24T18:25:53.127578+00:00", "entity_id": "sensor.sonde_salon_16_1", "last_updated": "2016-08-24T18:25:53.127578+00:00", "attributes": {"battery_level": 0, "node_id": 16, "V_TEMP": "30.5", "device": "COM4", "child_id": 1, "friendly_name": "Salon", "unit_of_measurement": "\u00b0C"}}}}

try:

automation:
  - alias: 'Lumiere_salon'
  trigger:
    - plateforme: state
    entity_id: binary_sensor.bouton_salon_19_0
    from: 'off'
    to: 'on'
  action:
    service: switch.toggle
    entity_id: switch.prise_10_2
1 Like

You still have a typo, it should be platform instead of the french plateforme.

1 Like

Plateform…
I feel like a c…
Thank you a lot men.
I have to test this afternoon but I think that’should the mistake

I don’t understand.
Really I made lot of other tests but nothing work at all
platform ok!
indentation is ok? (I don’t know how to post code… sorry).
Then, I really don’t understand
I see on debug when I push “bouton 19”
And when I call service switch.toggle, all switches toggles

automation:

  • alias:
    trigger:
    • plateform: state
      entity_id: binary_sensor.bouton_salon_19_0
      from: ‘off’
      to: ‘on’
      action:
      service: switch.toggle
      entity_id: switch.prise_10_2

‘’

how do you call switch.toggle?

if they all toggle there are 2 options: (i can think about)

  1. the entity you call is not valid and HA calls all of them
  2. all switches are related to the same sensor somehow.

i had that last one when i made some template switches which al switched when i switched 1 of them.

Still misspelling platform. Code should be posted in the forum within code block markdown. That’s three back-tics, newline, code, newline, three back-tics.

Hi, all.

Thanks martinhjelmare, you are right.
Now it work fine.

1 Like