Mitsubishi MELCLOUD integration with Home Assistant

Hi, happy to help.

So that’s the way I make my call to the API and how I extract the compressor frequency in my configuration.yaml :

 - platform: command_line 
    command: 'curl -v -H "X-MitsContextKey: xxxxxyourkeyherexxxx" "https://app.melcloud.com/Mitsubishi.Wifi.Client/user/ListDevices?id=xxxxxxx&buildingID=xxxxxx"| jq ".[].Structure.Devices[].Device"'    
    name: Ecodan

    json_attributes:
      - FlowTemperature
      - FlowTemperatureZone1
      - FlowTemperatureZone2
      - HeatPumpFrequency
      - OutdoorTemperature
      - ReturnTemperature
      - ReturnTemperatureZone1
      - ReturnTemperatureZone2
      - TargetHCTemperatureZone1
      - TargetHCTemperatureZone2
    value_template: '{{ value_json.FlowTemperature }}'
    scan_interval: 30
    command_timeout: 10

  - platform: template
    sensors:
      ecodan_cprfrequency:
        entity_id: sensor.ecodan
        friendly_name_template: Ecodan_CprFrequency 
        unit_of_measurement: 'Hz'
        value_template: "{{ state_attr('sensor.ecodan', 'HeatPumpFrequency') }}"

Then this is the automation I use (in automations.yaml)

- id: '1601905305249'
  alias: New Automation
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.ecodan_cprfrequency
    to: '0'
  condition: []
  action:
  - entity_id: counter.cprstopcount
    service: counter.increment
  - delay: 00:20:00
  - entity_id: counter.cprstopcount
    service: counter.reset
  mode: restart

- id: '1601928986834'
  alias: change setting when counter is bigger than 0
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: counter.cprstopcount
    above: '1'
  condition: []
  action:
  - service: climate.set_temperature
    data:
      temperature: '15'
    entity_id: climate.mitsubishi_zone_1
  - service: climate.set_temperature
    data:
      temperature: '15'
    entity_id: climate.mitsubishi_zone_2
  - delay: 00:59:00
  - service: climate.set_temperature
    data:
      temperature: '22'
    entity_id: climate.mitsubishi_zone_1
  - service: climate.set_temperature
    data:
      temperature: '22'
    entity_id: climate.mitsubishi_zone_2
  mode: single

I just changed from melcloud interface to modbus interface (found a 2nd hand Procon A1M) but not sure I can do much more than what can be done via the API and melcloud… I had higher expectations.

Regards
Guido