Sennevds / system_sensors

Logging of system sensor specific for the RPI and sending them to a MQTT broker
MIT License
361 stars 112 forks source link

Fix Display Switch MQTT JSON payload #170

Closed MattyRoy closed 8 months ago

MattyRoy commented 8 months ago

This fix ensures that the Display Switch MQTT payload is valid JSON - there is a warning logged by Home Assistant which shows up as:

Unable to parse JSON display: '{"name":"inverterpi Display Switch","state_topic":"system-sensors/sensor/inverterpi/state","value_template":"{{value_json.display}}","unique_id":"inverterpi_switch_display","availability_topic":"system-sensors/sensor/inverterpi/availability","device":{"identifiers":["inverterpi_sensor"],"name":"inverterpi Sensors","model":"RPI Foundation inverterpi", "manufacturer":"RPI Foundation"},"icon":"mdi:monitor",{'availability_topic': 'system-sensors/sensor/{device_name}/availability', 'command_topic': 'system-sensors/sensor/{device_name}/command', 'state_topic': 'system-sensors/sensor/{device_name}/state', 'value_template': '{{value_json.display}}', 'state_off': '0', 'state_on': '1', 'payload_off': 'display_off', 'payload_on': 'display_on'}}'