Changed device type for temperature

This commit is contained in:
Addie Janssen
2020-09-27 14:26:06 +02:00
parent a4fd93c5c8
commit 50f6f41d6e

View File

@ -210,7 +210,7 @@ THREE_PHASE_INVERTER = [
[Unit.CURRENT_DC, "DC Current", 0xF3, 0x17, 0x00, {}, "current_dc", "current_dc_scale", "{:.2f}", None, None, None ],
[Unit.VOLTAGE_DC, "DC Voltage", 0xF3, 0x08, 0x00, {}, "voltage_dc", "voltage_dc_scale", "{:.2f}", None, None, Average() ],
[Unit.POWER_DC, "DC Power", 0xF8, 0x01, 0x00, {}, "power_dc", "power_dc_scale", "{:.2f}", None, None, Average() ],
[Unit.TEMPERATURE, "Temperature", 0x50, 0x05, 0x00, {}, "temperature", "temperature_scale", "{:.2f}", None, None, Maximum() ]
[Unit.TEMPERATURE, "Temperature", 0xF3, 0x05, 0x00, {}, "temperature", "temperature_scale", "{:.2f}", None, None, Maximum() ]
]
#
@ -457,6 +457,33 @@ class BasePlugin:
if unit[Column.MATH]:
unit[Column.MATH].set_max_samples(self.max_samples)
# We updated some device types over time.
# Let's make sure that we have the correct type setup.
for unit in self._LOOKUP_TABLE:
if unit[Column.ID] in Devices:
device = Devices[unit[Column.ID]]
if (device.Type != unit[Column.TYPE] or
device.SubType != unit[Column.SUBTYPE] or
device.SwitchType != unit[Column.SWITCHTYPE] or
device.Options != unit[Column.OPTIONS]):
Domoticz.Log("Updating device \"{}\"".format(device.Name))
nValue = device.nValue
sValue = device.sValue
device.Update(
Type=unit[Column.TYPE],
Subtype=unit[Column.SUBTYPE],
Switchtype=unit[Column.SWITCHTYPE],
Options=unit[Column.OPTIONS],
nValue=nValue,
sValue=sValue
)
# Add missing devices if needed.
if self.add_devices: