LoRaWan fix initial last_seen uninitialized

This commit is contained in:
Theo Arends 2025-06-04 18:38:23 +02:00
parent 93a22628e5
commit 55c7dc0654
4 changed files with 4 additions and 8 deletions

View File

@ -21,7 +21,6 @@ class LwDecoLDS02
var door_open var door_open
## SENSOR DATA ## ## SENSOR DATA ##
if 10 == FPort && Bytes.size() == 10 if 10 == FPort && Bytes.size() == 10
last_seen = tasmota.rtc('local')
door_open = ( Bytes[0] & 0x80 ) ? 1 : 0 door_open = ( Bytes[0] & 0x80 ) ? 1 : 0
data.insert("DoorOpen", ( door_open ) ? true : false) data.insert("DoorOpen", ( door_open ) ? true : false)
data.insert("BattV", ( Bytes[1] | (Bytes[0] << 8) & 0x3FFF ) / 1000.0) data.insert("BattV", ( Bytes[1] | (Bytes[0] << 8) & 0x3FFF ) / 1000.0)
@ -36,6 +35,7 @@ class LwDecoLDS02
end #Fport end #Fport
if valid_values if valid_values
last_seen = tasmota.rtc('local')
if global.lds02Nodes.find(Node) if global.lds02Nodes.find(Node)
global.lds02Nodes.remove(Node) global.lds02Nodes.remove(Node)
end end

View File

@ -32,8 +32,6 @@ class LwDecoLHT52
end end
## SENSOR DATA ## ## SENSOR DATA ##
if 2 == FPort && Bytes.size() == 11 if 2 == FPort && Bytes.size() == 11
last_seen = tasmota.rtc('local')
var TempC var TempC
TempC = Bytes[0] << 8 | Bytes[1] TempC = Bytes[0] << 8 | Bytes[1]
if Bytes[0] > 0x7F if Bytes[0] > 0x7F
@ -78,6 +76,7 @@ class LwDecoLHT52
end #Fport end #Fport
if valid_values if valid_values
last_seen = tasmota.rtc('local')
if global.lht52Nodes.find(Node) if global.lht52Nodes.find(Node)
global.lht52Nodes.remove(Node) global.lht52Nodes.remove(Node)
end end

View File

@ -41,7 +41,6 @@ class LwDecoLHT65
var TempC var TempC
if Ext == 9 #Sensor E3, Temperature Sensor, Datalog Mod if Ext == 9 #Sensor E3, Temperature Sensor, Datalog Mod
last_seen = tasmota.rtc('local')
TempC = ((Bytes[0] << 8) | Bytes[1]) TempC = ((Bytes[0] << 8) | Bytes[1])
if 0x7FFF == TempC if 0x7FFF == TempC
data.insert("Ext_SensorConnected", false) data.insert("Ext_SensorConnected", false)
@ -64,7 +63,6 @@ class LwDecoLHT65
end end
if Ext != 0x0F if Ext != 0x0F
last_seen = tasmota.rtc('local')
TempC = ((Bytes[2] << 8) | Bytes[3]) TempC = ((Bytes[2] << 8) | Bytes[3])
if Bytes[2]>0x7F if Bytes[2]>0x7F
TempC -= 0x10000 TempC -= 0x10000
@ -83,7 +81,6 @@ class LwDecoLHT65
if 0 == Ext if 0 == Ext
data.insert("Ext_sensor", 'No external sensor') data.insert("Ext_sensor", 'No external sensor')
elif 1==Ext elif 1==Ext
last_seen = tasmota.rtc('local')
data.insert("Ext_sensor",'Temperature Sensor') data.insert("Ext_sensor",'Temperature Sensor')
TempC = ((Bytes[7] << 8) | Bytes[8]) TempC = ((Bytes[7] << 8) | Bytes[8])
if 0x7FFF == TempC if 0x7FFF == TempC
@ -98,7 +95,6 @@ class LwDecoLHT65
valid_values = true valid_values = true
end end
elif 4 == Ext elif 4 == Ext
last_seen = tasmota.rtc('local')
data.insert("Work_mode", 'Interrupt Sensor send') data.insert("Work_mode", 'Interrupt Sensor send')
door_open = ( Bytes[7] ) ? 0 : 1 # DS sensor door_open = ( Bytes[7] ) ? 0 : 1 # DS sensor
data.insert("Exti_pin_level", Bytes[7] ? 'High' : 'Low') data.insert("Exti_pin_level", Bytes[7] ? 'High' : 'Low')
@ -141,6 +137,7 @@ class LwDecoLHT65
end #Fport end #Fport
if valid_values if valid_values
last_seen = tasmota.rtc('local')
if global.lht65Nodes.find(Node) if global.lht65Nodes.find(Node)
global.lht65Nodes.remove(Node) global.lht65Nodes.remove(Node)
end end

View File

@ -24,7 +24,6 @@ class LwDecoDW10
var humidity var humidity
## SENSOR DATA ## ## SENSOR DATA ##
if 120 == FPort && Bytes.size() == 9 if 120 == FPort && Bytes.size() == 9
last_seen = tasmota.rtc('local')
door_open = ( Bytes[0] & 0x01 ) ? 1 : 0 door_open = ( Bytes[0] & 0x01 ) ? 1 : 0
data.insert("DoorOpen", ( door_open ) ? true : false ) data.insert("DoorOpen", ( door_open ) ? true : false )
button_pressed = ( Bytes[0] & 0x02 ) ? 1 : 0 button_pressed = ( Bytes[0] & 0x02 ) ? 1 : 0
@ -47,6 +46,7 @@ class LwDecoDW10
end #Fport end #Fport
if valid_values if valid_values
last_seen = tasmota.rtc('local')
if global.dw10Nodes.find(Node) if global.dw10Nodes.find(Node)
global.dw10Nodes.remove(Node) global.dw10Nodes.remove(Node)
end end