Skip to content

Smart Home Panel (MQTT)Β #5

@Ne0-Hack3r

Description

@Ne0-Hack3r

Here is what I've come up with thus far in terms of linking SHP to HA via MQTT...

First, follow the instructions from @lwsrbrts in ISSUE #1

Second, configure your mosquito.conf like this:
image
Note: The format of 'topic' here is intended to obfuscate the serial number such that it only has to be entered once into the mosquito.conf and everything else can then be addresses as /ecoflow/SHP/... on the local broker. The same could be done for Delta Pro using ../DP/.. or ../DP1/.. ../DP2/.. for example.

Third, build automations for each params.id you want to monitor to place the messages for those into separate topics...

- id: '**random#**'
  alias: SHP - Circuits
  description: ''
  trigger:
  - platform: mqtt
    topic: ecoflow/SHP/data
    payload: 96
    value_template: '{{ value_json.params[''id''] }}'
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: ecoflow/SHP/circuits
      payload: '{{trigger.payload}}'
  mode: single

- id: '**random#**'
  alias: SHP - Info
  description: ''
  trigger:
  - platform: mqtt
    topic: ecoflow/SHP/data
    payload: 2
    value_template: '{{ value_json.params[''id''] }}'
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: ecoflow/SHP/info
      payload: '{{trigger.payload}}'
  mode: single

- id: '**random#**'
  alias: SHP - Limits
  description: ''
  trigger:
  - platform: mqtt
    topic: ecoflow/SHP/data
    payload: 30
    value_template: '{{ value_json.params[''id''] }}'
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: ecoflow/SHP/limits
      payload: '{{trigger.payload}}'
  mode: single

- id: '**random#**'
  alias: SHP - Voltage
  description: ''
  trigger:
  - platform: mqtt
    topic: ecoflow/SHP/data
    payload: 113
    value_template: '{{ value_json.params[''id''] }}'
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: ecoflow/SHP/voltage
      payload: '{{trigger.payload}}'
  mode: single

Fourth, create MQTT sensors for each topic above to pull key/value pairs into entity attributes in HA:

  - name: SHP-Circuits
    state_topic: "ecoflow/SHP/circuits"
    qos: 0
    value_template: "on"
    json_attributes_template: "{{ value_json.params | tojson}}"
    json_attributes_topic: "ecoflow/SHP/circuits"

  - name: SHP-Info
    state_topic: "ecoflow/SHP/info"
    qos: 0
    value_template: "on"
    json_attributes_template: "{{ value_json.params | tojson}}"
    json_attributes_topic: "ecoflow/SHP/info"

  - name: SHP-Limits
    state_topic: "ecoflow/SHP/limits"
    qos: 0
    value_template: "on"
    json_attributes_template: "{{ value_json.params | tojson}}"
    json_attributes_topic: "ecoflow/SHP/limits"

  - name: SHP-Voltage
    state_topic: "ecoflow/SHP/voltage"
    qos: 0
    value_template: "on"
    json_attributes_template: "{{ value_json.params | tojson}}"
    json_attributes_topic: "ecoflow/SHP/voltage"

Finally, create whatever custom sensors you want using the attributes from above...

Here are example sensors for the power on each circuit:
# SHP - Circuit Power
  - name: "SHP Circuit 1 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[0].chWatt | round(0) }}

  - name: "SHP Circuit 2 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[1].chWatt | round(0) }}

  - name: "SHP Circuit 3 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[2].chWatt | round(0) }}

  - name: "SHP Circuit 4 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[3].chWatt | round(0) }}

  - name: "SHP Circuit 5 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[4].chWatt | round(0) }}

  - name: "SHP Circuit 6 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[5].chWatt | round(0) }}

  - name: "SHP Circuit 7 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[6].chWatt | round(0) }}

  - name: "SHP Circuit 8 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[7].chWatt | round(0) }}

  - name: "SHP Circuit 9 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[8].chWatt | round(0) }}

  - name: "SHP Circuit 10 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[9].chWatt | round(0) }}

  - name: "SHP PRO1 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[10].chWatt | round(0) }}

  - name: "SHP PRO2 Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList')[11].chWatt | round(0) }}

  - name: "SHP ALL Circuit Power"
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    state: >- 
      {{ state_attr('sensor.shp_circuits','infoList') | sum(attribute='chWatt') | round(0) }}

Here are some binary sensors that might be useful:

# Binary Sensors
- binary_sensor:

# SHP - Status
  - name: "SHP Grid Available"
    state: >- 
      {{ state_attr('sensor.shp_info','gridSta') == 1 }}

  - name: "SHP Pro1 Connected"
    state: >- 
      {{ state_attr('sensor.shp_info','energyInfos')[0].stateBean.isConnect == 1}}

  - name: "SHP Pro1 Enabled"
    state: >- 
      {{ state_attr('sensor.shp_info','energyInfos')[0].stateBean.isEnable == 1}}

  - name: "SHP Pro2 Connected"
    state: >- 
      {{ state_attr('sensor.shp_info','energyInfos')[1].stateBean.isConnect == 1}}

  - name: "SHP Pro2 Enabled"
    state: >- 
      {{ state_attr('sensor.shp_info','energyInfos')[1].stateBean.isEnable == 1}}

Once you have the custom sensors you want you can use them to create dashboards with lists, gauges, etc.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions