Hi,
I have question regarding inputs value via MQTT.
Configuration is like:
[Blockierte Grafik: https://smarthome-forum.eu/index.php?attachment/24505-pasted-from-clipboard-png/&thumbnail=1]
MQTT topic / server is also set in settings for MQTT..
So, currently I can control and see status via MQTT for sensors:
Relay (1-4)
Current consumption (1-4)
Total consumption (1-4)
Current voltage (1-4)
But I would like also to have binary status of inputs, so that my smart home (Home Assistant) can do some automations regarding that etc..
Example of sensors:
###### Voltage 1
- platform: mqtt
name: "Shelly Pro 4PM - SW1 napetost"
state_topic: "shellypro4pm-XXXX/status/switch:0"
unit_of_measurement: "V"
value_template: "{{ value_json.voltage }}"
###### Power 1
- platform: mqtt
name: "Shelly Pro 4PM - SW1 poraba"
unit_of_measurement: "W"
state_topic: "shellypro4pm-XXXX/status/switch:0"
value_template: "{{ value_json.apower }}"
###### Energy 1
- platform: mqtt
name: "Shelly Pro 4PM - SW1 skupaj poraba"
unit_of_measurement: "kWh"
icon: mdi:flash-circle
state_topic: "shellypro4pm-XXXX/status/switch:0"
value_template: "{{ value_json['aENERGY'].Total }}"
Example of switch:
- platform: mqtt
name: "Shelly Pro 4PM Relay 1"
unique_id: "shellypro4pm-XXXX-switch-0"
command_topic: "shellypro4pm-XXXX/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-XXXX/status/switch:0"
value_template: "{{ value_json.output }}"
state_on: true
state_off: false
qos: 1
So, can you help me how to make binary_sensor for inputs. Do I need to use new "mode" scripts to achieve that and how to do that (what would be the script)? I do not know where to find info what would be payload ON and payload OFF, woth that info I can manage to make input mqtt binary sensors..
Thank you for helping me out...