Ooops, sorry for not displaying the icon image for you.
Default (mylight.svg)
Green (mylight-green.svg) (off)
Red (mylight-red.svg) (on)
I think they have changed the status from ON to OFF and OFF to ON.
Actually, the default image is displayed by the custom icon setting?
Since it is always there, I didn’t mention the presentation of default image at all.
Also, I have changed the icon image name now but the condition looks like the same.
==> /var/log/openhab2/events.log <==
2020-06-01 00:54:03.713 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 3.8 to 28.1
2020-06-01 00:54:03.719 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 39 to 288
2020-06-01 00:54:03.726 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 3.8 to 28.1
2020-06-01 00:54:03.733 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 39 to 288
2020-06-01 00:54:03.742 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e5_Bed_1_status changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2020-06-01 00:54:03.742 [INFO ] [.eclipse.smarthome.model.script.Rule] - start to manage the status!
==> /var/log/openhab2/events.log <==
2020-06-01 00:54:03.745 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e_Bed_1_status changed from ON to OFF
2020-06-01 00:54:03.746 [vent.ItemStateChangedEvent] - Bed1Status changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2020-06-01 00:54:03.749 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert 'green' to a state type which item 'Bed1Status' accepts: [OnOffType, UnDefType].
2020-06-01 00:54:04.215 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":0,"percent":0.00,"status":1}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":0,"percent":0.00,"status":1}
==> /var/log/openhab2/events.log <==
2020-06-01 00:54:04.230 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 28.1 to 0.0
2020-06-01 00:54:04.246 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 288 to 0
2020-06-01 00:54:04.262 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 28.1 to 0.0
2020-06-01 00:54:04.276 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 288 to 0
2020-06-01 00:54:04.287 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e5_Bed_1_status changed from OFF to ON
2020-06-01 00:54:04.290 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e_Bed_1_status changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2020-06-01 00:54:04.290 [INFO ] [.eclipse.smarthome.model.script.Rule] - start to manage the status!
==> /var/log/openhab2/events.log <==
2020-06-01 00:54:04.293 [vent.ItemStateChangedEvent] - Bed1Status changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2020-06-01 00:54:04.299 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert 'green' to a state type which item 'Bed1Status' accepts: [OnOffType, UnDefType].
2020-06-01 00:54:04.720 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":0,"percent":0.00,"status":1}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":0,"percent":0.00,"status":1}
2020-06-01 00:54:05.228 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":0,"percent":0.00,"status":1}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":0,"percent":0.00,"status":1}
I noticed that there is a warning about the postUpdate (for the “green” part and “red” part). So I changed the .rules file into this.
Also, I noticed the log of INFO.
2020-06-01 01:04:46.464 [INFO ] [.eclipse.smarthome.model.script.Rule] - start to manage the status!
This is the .rules file:
rule "Bed Exit"
when
Item Bed1Status changed
then
logInfo("Rule", "start to manage the status!")
if(Bed1Status.state == "ON")
{
Bed1Status.postUpdate("ON")
}
else if (Bed1Status.state == "OFF")
{
Bed1Status.postUpdate("OFF")
}
end
This is the figure I want to illustrate that the icon is as static as always.
This is the pure log after changing the postUpdate
==> /var/log/openhab2/events.log <==
2020-06-01 01:04:46.395 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 0.0 to 29.7
2020-06-01 01:04:46.408 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 0 to 304
2020-06-01 01:04:46.422 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 0.0 to 29.7
2020-06-01 01:04:46.432 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 0 to 304
2020-06-01 01:04:46.448 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e5_Bed_1_status changed from ON to OFF
2020-06-01 01:04:46.452 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e_Bed_1_status changed from ON to OFF
2020-06-01 01:04:46.460 [vent.ItemStateChangedEvent] - Bed1Status changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2020-06-01 01:04:46.464 [INFO ] [.eclipse.smarthome.model.script.Rule] - start to manage the status!
2020-06-01 01:04:46.883 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":180,"percent":17.50,"status":0}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":180,"percent":17.50,"status":0}
==> /var/log/openhab2/events.log <==
2020-06-01 01:04:46.891 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 29.7 to 17.5
2020-06-01 01:04:46.897 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 304 to 180
2020-06-01 01:04:46.906 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 29.7 to 17.5
2020-06-01 01:04:46.912 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 304 to 180
==> /var/log/openhab2/openhab.log <==
2020-06-01 01:04:47.392 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":448,"percent":43.70,"status":0}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":448,"percent":43.70,"status":0}
==> /var/log/openhab2/events.log <==
2020-06-01 01:04:47.408 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 17.5 to 43.7
2020-06-01 01:04:47.421 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 180 to 448
2020-06-01 01:04:47.433 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 17.5 to 43.7
2020-06-01 01:04:47.445 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 180 to 448
==> /var/log/openhab2/openhab.log <==
2020-06-01 01:04:47.898 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"analog":87,"percent":8.50,"status":1}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"analog":87,"percent":8.50,"status":1}
==> /var/log/openhab2/events.log <==
2020-06-01 01:04:47.904 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent changed from 43.7 to 8.5
2020-06-01 01:04:47.911 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog_num changed from 448 to 87
2020-06-01 01:04:47.917 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_percent_num changed from 43.7 to 8.5
2020-06-01 01:04:47.924 [vent.ItemStateChangedEvent] - mqtt_topic_ba6a06c9_Bed_1_analog changed from 448 to 87
2020-06-01 01:04:47.931 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e5_Bed_1_status changed from OFF to ON
2020-06-01 01:04:47.932 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e_Bed_1_status changed from OFF to ON
2020-06-01 01:04:47.934 [vent.ItemStateChangedEvent] - Bed1Status changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2020-06-01 01:04:47.938 [INFO ] [.eclipse.smarthome.model.script.Rule] - start to manage the status!
Last but not least, all switch work fine in the log except the dynamic icon.
This is the original item.
2020-06-01 01:04:47.931 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e5_Bed_1_status changed from OFF to ON
This is the manually created in PaperUI.
2020-06-01 01:04:47.932 [vent.ItemStateChangedEvent] - mqtt_topic_736bf7e_Bed_1_status changed from OFF to ON
The is the extension one from VS code.
2020-06-01 01:04:47.934 [vent.ItemStateChangedEvent] - Bed1Status changed from OFF to ON
Thanks a lot for your effort!! I am really appreciate that.