Fix Konnected DS18B20 poll interval (#59954)

* Konnected - Fix DS18B20 poll interval.

The poll interval for the DS18B20 was not being sent to the device.

* Fix tests
This commit is contained in:
h2zero 2021-11-22 06:01:37 -07:00 committed by GitHub
parent 5608b4fb18
commit 3b5a7d001f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -304,7 +304,9 @@ class AlarmPanel:
def async_ds18b20_sensor_configuration(self): def async_ds18b20_sensor_configuration(self):
"""Return the configuration map for syncing DS18B20 sensors.""" """Return the configuration map for syncing DS18B20 sensors."""
return [ return [
self.format_zone(sensor[CONF_ZONE]) self.format_zone(
sensor[CONF_ZONE], {CONF_POLL_INTERVAL: sensor[CONF_POLL_INTERVAL]}
)
for sensor in self.stored_configuration[CONF_SENSORS] for sensor in self.stored_configuration[CONF_SENSORS]
if sensor[CONF_TYPE] == "ds18b20" if sensor[CONF_TYPE] == "ds18b20"
] ]

View File

@ -144,7 +144,7 @@ async def test_create_and_setup(hass, mock_panel):
"sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}], "sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}],
"actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}], "actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}],
"dht_sensors": [{"poll_interval": 3, "pin": "6"}], "dht_sensors": [{"poll_interval": 3, "pin": "6"}],
"ds18b20_sensors": [{"pin": "7"}], "ds18b20_sensors": [{"poll_interval": 3, "pin": "7"}],
"auth_token": "11223344556677889900", "auth_token": "11223344556677889900",
"blink": True, "blink": True,
"discovery": True, "discovery": True,
@ -240,7 +240,7 @@ async def test_create_and_setup_pro(hass, mock_panel):
], ],
"sensors": [ "sensors": [
{"zone": "3", "type": "dht", "poll_interval": 5}, {"zone": "3", "type": "dht", "poll_interval": 5},
{"zone": "7", "type": "ds18b20", "name": "temper"}, {"zone": "7", "type": "ds18b20", "poll_interval": 1, "name": "temper"},
], ],
"switches": [ "switches": [
{"zone": "4"}, {"zone": "4"},
@ -302,7 +302,7 @@ async def test_create_and_setup_pro(hass, mock_panel):
{"trigger": 1, "zone": "alarm1"}, {"trigger": 1, "zone": "alarm1"},
], ],
"dht_sensors": [{"poll_interval": 5, "zone": "3"}], "dht_sensors": [{"poll_interval": 5, "zone": "3"}],
"ds18b20_sensors": [{"zone": "7"}], "ds18b20_sensors": [{"poll_interval": 1, "zone": "7"}],
"auth_token": "11223344556677889900", "auth_token": "11223344556677889900",
"blink": True, "blink": True,
"discovery": True, "discovery": True,
@ -344,7 +344,7 @@ async def test_create_and_setup_pro(hass, mock_panel):
"type": "dht", "type": "dht",
"zone": "3", "zone": "3",
}, },
{"name": "temper", "poll_interval": 3, "type": "ds18b20", "zone": "7"}, {"name": "temper", "poll_interval": 1, "type": "ds18b20", "zone": "7"},
], ],
"switches": [ "switches": [
{ {
@ -492,7 +492,7 @@ async def test_default_options(hass, mock_panel):
"sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}], "sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}],
"actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}], "actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}],
"dht_sensors": [{"poll_interval": 3, "pin": "6"}], "dht_sensors": [{"poll_interval": 3, "pin": "6"}],
"ds18b20_sensors": [{"pin": "7"}], "ds18b20_sensors": [{"poll_interval": 3, "pin": "7"}],
"auth_token": "11223344556677889900", "auth_token": "11223344556677889900",
"blink": True, "blink": True,
"discovery": True, "discovery": True,