i have a problem with serial binding and regex. The Switch state in BASICUI does not change when item changing from ON to OFF or vice versa.
The incoming string in serial port look like -100;12100;ON;ON
I run OH 2.5 M1 build with Zulu Java package
My items is:
Number UPS_Current "Ток АКБ [%d]" { serial="/dev/ttyS0@19200,REGEX(^(-?\\d{1,5}))" ,autoupdate="true"}
Number UPS_Voltage "Напряжкение АКБ [%d]" { serial="/dev/ttyS0@19200,REGEX(;(\\d{1,5});)" ,autoupdate="true"}
Switch Main_Power_220 "Сеть 220V [%s]" { serial="/dev/ttyS0@19200,REGEX(.*;(\\D{2,3});)" ,autoupdate="true"}
My openhab.log:
2019-12-25 14:02:38.759 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-9;12888;ON;ON
' by the function '^(-?\d{1,5})'
2019-12-25 14:02:38.786 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-9;12888;ON;ON
' by the function '.*;(\D{2,3});'
2019-12-25 14:02:38.813 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-9;12888;ON;ON
' by the function ';(\d{1,5});'
2019-12-25 14:02:40.247 [DEBUG] [binding.serial.internal.SerialDevice] - Received message '-3;12888;ON;ON
' on serial port /dev/ttyS0
2019-12-25 14:02:40.257 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-3;12888;ON;ON
' by the function '^(-?\d{1,5})'
2019-12-25 14:02:40.280 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-3;12888;ON;ON
' by the function '.*;(\D{2,3});'
2019-12-25 14:02:40.318 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-3;12888;ON;ON
' by the function ';(\d{1,5});'
2019-12-25 14:02:41.745 [DEBUG] [binding.serial.internal.SerialDevice] - Received message '-7;12888;ON;ON
' on serial port /dev/ttyS0
2019-12-25 14:02:41.752 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-7;12888;ON;ON
' by the function '^(-?\d{1,5})'
2019-12-25 14:02:41.775 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-7;12888;ON;ON
' by the function '.*;(\D{2,3});'
2019-12-25 14:02:41.808 [DEBUG] [.serial.internal.RegexPatternMatcher] - about to transform '-7;12888;ON;ON
' by the function ';(\d{1,5});'
event.log
2019-12-25 14:02:02.828 [thome.event.ItemStateEvent] - Main_Power_220 updated to ON
2019-12-25 14:02:02.851 [thome.event.ItemStateEvent] - UPS_Voltage updated to 12888
2019-12-25 14:02:04.265 [thome.event.ItemStateEvent] - UPS_Current updated to -7
2019-12-25 14:02:04.299 [thome.event.ItemStateEvent] - Main_Power_220 updated to ON
2019-12-25 14:02:04.340 [thome.event.ItemStateEvent] - UPS_Voltage updated to 12888
2019-12-25 14:02:05.787 [thome.event.ItemStateEvent] - UPS_Current updated to -9
2019-12-25 14:02:05.843 [vent.ItemStateChangedEvent] - UPS_Current changed from -7 to -9
2019-12-25 14:02:05.880 [thome.event.ItemStateEvent] - Main_Power_220 updated to ON
2019-12-25 14:02:05.907 [thome.event.ItemStateEvent] - UPS_Voltage updated to 12888
2019-12-25 14:02:07.318 [thome.event.ItemStateEvent] - UPS_Current updated to -4
2019-12-25 14:02:07.352 [vent.ItemStateChangedEvent] - UPS_Current changed from -9 to -4
2019-12-25 14:02:07.387 [thome.event.ItemStateEvent] - Main_Power_220 updated to ON
2019-12-25 14:02:07.407 [thome.event.ItemStateEvent] - UPS_Voltage updated to 12888
this is sitemap:
Group item=Hardware label="UPS" icon="heating" {
Text item=UPS_Current
Text item=UPS_Voltage
Switch item=Main_Power_220 valuecolor=[Main_Power_220=="ON"="green",Main_Power_220=="OFF"="red"]
}
UPS_Current and UPS_Voltage displayed fine. But Main_Power_220V does not change depending on item state (ON or OFF). When i turned off power item Main_Power_220V not changed from ON to OFF. Why?
2019-12-24 20:01:17.270 [thome.event.ItemStateEvent] - Main_Power_220 updated to ON
2019-12-24 20:01:17.293 [thome.event.ItemStateEvent] - UPS_Voltage updated to 12852
2019-12-24 20:01:17.320 [vent.ItemStateChangedEvent] - UPS_Current changed from -30 to -37
2019-12-24 20:01:18.749 [thome.event.ItemStateEvent] - UPS_Current updated to 6375
2019-12-24 20:01:18.792 [vent.ItemStateChangedEvent] - UPS_Current changed from -37 to 6375
*2019-12-24 20:01:18.814 [thome.event.ItemStateEvent] - Main_Power_220 updated to OFF*