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

View File

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

View File

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

View File

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