CJNE / ha-myenergi

Home Assistant integration for MyEnergi devices
MIT License
150 stars 33 forks source link

Support MODE request, enabling stopping Eddi (and other devices) #387

Open ByteMavericks opened 1 year ago

ByteMavericks commented 1 year ago

Eddi (and other devices) support a MODE request, which can turn the device off. This would be very useful to allow fine control over when to turn on Eddi (eg solar battery > 90%, return to grid > 100W).

This appears to be supported in PyMyEnergi; EDDI_MODES is defined in eddi.py as "Stopped" and "Normal", and the CLI implementation simply sends the mode using set_operating_mode.

So I think this should be straightforward - add as a service definition in the HA side of things? Or possibly as a switch?

Happy to help any way I can, but I've never looked at HA extensions, and don't really love Python...

LeiChat commented 1 year ago

I think you can switch eddi mode calling service select.select_option against the _operating_mode entity.

image

ByteMavericks commented 1 year ago

Thank you, that's great - works a dream! I'll look to see how to create a switch around this and share here.

ByteMavericks commented 1 year ago

Yes, easy to do: have created a helper, then an automation:

alias: Eddi-sync
description: ""
trigger:
  - platform: state
    entity_id:
      - input_select.eddi_states
condition: []
action:
  - service: select.select_option
    data:
      option: "{{ states('input_select.eddi_states') }} "
    target:
      entity_id: select.myenergi_eddi_21531956_operating_mode
mode: single