Service: fan.oscillate en mode toggle

Mon problème

Je viens d’installer un ventilateur Mi Smart Standing 2 (dmaker.fan.p18) avec l’intégration GitHub - syssi/xiaomi_fan: Xiaomi Mi Smart Fan integration for Home Assistant qui a l’air d’être la seul a prendre en charge ce model. ( si vous connaissez mieux je suis preneur :wink: )

Mon soucis est que je voudrais utiliser la fonction « osciller » sur un cube aqara, sur une seul action en mode toggle. Le problème est que le service pour l’activer/désactiver n’est pas un toggle.

Pourtant j’ai un switch dans les options.
fan 2

Auriez-vous une solution ?

Ma configuration


System Health

version core-2022.4.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.103-v8
arch aarch64
timezone Europe/Paris
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4999
Installed Version 1.24.5
Stage running
Available Repositories 1032
Downloaded Repositories 58
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 7.6
update_channel stable
supervisor_version supervisor-2022.04.0
docker_version 20.10.9
disk_total 28.6 GB
disk_used 4.1 GB
healthy true
supported true
board rpi3-64
supervisor_api ok
version_api ok
installed_addons Samba share (9.6.1), Duck DNS (1.14.0), File editor (5.3.3), Terminal & SSH (9.4.0)
Dashboards
dashboards 1
resources 37
views 11
mode storage
Spotify
api_endpoint_reachable ok
___

Salut

C’est pas juste l’appel de toggle sur un switch ?

C’est ce a quoi j’ai penser, mais aucune entité du fan dans la liste.
avec le service turn.toggle, je peu choisir le on/off du fan mais pas pour l’osciller.
avec le switch.toggle, aucune entité disponible.

Salut,
Effectivement pas de toggle pour ce service.
Du coup une solution est d’utiliser 2 automatisations, une pour l’allumer avec en condition qu’il soit éteint et inversement. J’ai testé, ça fonctionne bien. Je te les mets si tu veux les utiliser.

alias: Fan oscillation ON
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: #l'id de ton cube aqara
    type: action
    subtype: shake
    discovery_id: 0x00158d00054bc9be action_shake
condition:
  - condition: state
    entity_id: #ton ventilateur
    state: false
    attribute: oscillating
action:
  - service: fan.oscillate
    data:
      oscillating: true
    target:
      entity_id: #ton ventilateur
mode: single
alias: Fan oscillation OFF
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: #l'id de ton cube aqara
    type: action
    subtype: shake
    discovery_id: 0x00158d00054bc9be action_shake
condition:
  - condition: state
    entity_id: #ton ventilateur
    state: true
    attribute: oscillating
action:
  - service: fan.oscillate
    data:
      oscillating: false
    target:
      entity_id: #ton ventilateur
mode: single

1 « J'aime »

Bonne idée, par contre je suis sous zha mais je vais adapter :wink:
je vais tester ça de suite, merci.

Yes, t’as juste le trigger à changer.

J’ai un soucis avec la condition, elle ne passe pas. Pourtant la condition est bonne quand je regarde les attributs du fan.
J’ai essayer avec l’attribut oscillating et oscillate , aucun ne passe la condition. Je ne vois pas mon erreur.

alias: Ventilateur osciller ON
description: ''
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: e6dd7c5655341bb1ce061***********
      command: slide
condition:
  - condition: state
    entity_id: fan.mi_smart_standing_fan_2
    attribute: oscillating
    state: 'false'
action:
  - service: fan.oscillate
    data:
      oscillating: true
    target:
      entity_id: fan.mi_smart_standing_fan_2
mode: single

Essai ça

alias: Ventilateur osciller ON
description: ''
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: e6dd7c5655341bb1ce061***********
      command: slide
condition:
  - condition: state
    entity_id: fan.mi_smart_standing_fan_2
    attribute: oscillating
    state: false
action:
  - service: fan.oscillate
    data:
      oscillating: true
    target:
      entity_id: fan.mi_smart_standing_fan_2
mode: single
1 « J'aime »

Merci, ça fonctionne comme un charme. C’était donc le state: ‹ false › qui chier.
je partage les automatisation pour zha .

alias: Ventilateur osciller ON
description: ''
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: e6dd7c5655341bb1ce061***********    #device_id du cube
      command: slide
condition:
  - condition: state
    entity_id: fan.mi_smart_standing_fan_2
    attribute: oscillating
    state: false
action:
  - service: fan.oscillate
    data:
      oscillating: true
    target:
      entity_id: fan.mi_smart_standing_fan_2
mode: single
alias: Ventilateur osciller OFF
description: ''
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: e6dd7c5655341bb1ce061***********   #device_id du cube
      command: slide
condition:
  - condition: state
    entity_id: fan.mi_smart_standing_fan_2
    attribute: oscillating
    state: true
action:
  - service: fan.oscillate
    data:
      oscillating: false
    target:
      entity_id: fan.mi_smart_standing_fan_2
mode: single
1 « J'aime »