Handle explicit Modbus NaN values (#90800)

Co-authored-by: jan iversen <jancasacondor@gmail.com>
This commit is contained in:
Johannes Wagner 2023-08-06 13:47:54 +02:00 committed by GitHub
parent 0511071757
commit c4a5373976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 2 deletions

View file

@ -9,6 +9,7 @@ from homeassistant.components.modbus.const import (
CONF_LAZY_ERROR,
CONF_MAX_VALUE,
CONF_MIN_VALUE,
CONF_NAN_VALUE,
CONF_PRECISION,
CONF_SCALE,
CONF_SLAVE_COUNT,
@ -558,6 +559,15 @@ async def test_config_wrong_struct_sensor(
False,
str(int(0x02010404)),
),
(
{
CONF_DATA_TYPE: DataType.INT32,
CONF_NAN_VALUE: "0x80000000",
},
[0x8000, 0x0000],
False,
STATE_UNAVAILABLE,
),
(
{
CONF_DATA_TYPE: DataType.INT32,