The current shelly integration is missing the state of the input switch. It would be binary sensor and can be taken directly from the api;
Shelly1/status/:
"wifi_sta": {
"connected": true,
"ssid": "ssid",
"ip": "192.168.1.xx",
"rssi": -61
},
"cloud": {
"enabled": false,
"connected": false
},
"mqtt": {
"connected": true
},
"time": "",
"unixtime": 0,
"serial": 31,
"has_update": false,
"mac": "B4E62D555852",
"cfg_changed_cnt": 0,
"actions_stats": {
"skipped": 0
},
"relays": [
{
"ison": true,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"source": "input"
}
],
"meters": [
{
"power": 0,
"is_valid": true
}
],
"inputs": [
{
"input": 0,
"event": "L",
"event_cnt": 30
}
],
"ext_sensors": {},
"ext_temperature": {},
"ext_humidity": {},
"update": {
"status": "unknown",
"has_update": false,
"new_version": "",
"old_version": "20200812-090904/v1.8.0@8acf41b0"
},
"ram_total": 51112,
"ram_free": 39508,
"fs_size": 233681,
"fs_free": 150600,
"uptime": 163443
}
Shelly2.5/status/
{
"wifi_sta": {
"connected": true,
"ssid": "ssid",
"ip": "192.168.1.xy",
"rssi": -64
},
"cloud": {
"enabled": false,
"connected": false
},
"mqtt": {
"connected": true
},
"time": "",
"unixtime": 0,
"serial": 2764,
"has_update": false,
"mac": "B4E62D5A4556",
"cfg_changed_cnt": 0,
"actions_stats": {
"skipped": 0
},
"relays": [
{
"ison": false,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"overpower": false,
"is_valid": true,
"source": "http"
},
{
"ison": true,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"overpower": false,
"is_valid": true,
"source": "input"
}
],
"meters": [
{
"power": 7.33,
"overpower": 0,
"is_valid": true,
"timestamp": 0,
"counters": [
0,
0,
0
],
"total": 0
}
],
"inputs": [
{
"input": 1,
"event": "L",
"event_cnt": 3
},
{
"input": 0,
"event": "L",
"event_cnt": 7
}
],
"update": {
"status": "unknown",
"has_update": false,
"new_version": "",
"old_version": "20200812-090940/v1.8.0@8acf41b0"
},
"ram_total": 50296,
"ram_free": 37748,
"fs_size": 233681,
"fs_free": 150600,
"voltage": 229.64,
"uptime": 163508
}
âinputâ: 0 or 1 gives the state of the input switch.
I donât understand the structure of the integration part completely, but I think it should be added to: binary_sensor.py