I am using mqtt to access my remote Shelly devices. By now, I have this in my configuration.yaml:
switch:
- platform: mqtt
name: “some name”
unique_id: “soem id”
command_topic: “shellypro4pm-c8c9a3ef5014/rpc”
payload_on: ‘{“id”: 1, “src”:“homeassistant”, “method”: “Switch.Set”, “params”: {“id”: 0, “on”: true}}’
payload_off: ‘{“id”: 1, “src”:“homeassistant”, “method”: “Switch.Set”, “params”: {“id”: 0, “on”: false}}’
state_topic: “shellypro4pm-c8c9a3ef5014/status/switch:0”
value_template: “{{ value_json.output }}”
state_on: true
state_off: false
qos: 1 - platform: mqtt
name: “some name”
unique_id: “some id”
command_topic: “shellypro4pm-c8c9a3ef5014/rpc”
payload_on: ‘{“id”: 1, “src”:“homeassistant”, “method”: “Switch.Set”, “params”: {“id”: 1, “on”: true}}’
payload_off: ‘{“id”: 1, “src”:“homeassistant”, “method”: “Switch.Set”, “params”: {“id”: 1, “on”: false}}’
state_topic: “shellypro4pm-c8c9a3ef5014/status/switch:1”
value_template: “{{ value_json.output }}”
state_on: true
state_off: false
qos: 1
This allows me to switch two channels on and off. I want, however, get information about current consumption, total consumption, current, voltage, etc. Any ideas how to code this in the configuration.yaml file?