Have a really simple setup, and have run into some problems in getting values from my rules to be shown in my BasicUI.
I just got a motion detector sensor, and I was going to start by just accumulating the number and presenting in the GUI.
.items
Number Movements
.rules
var m=0
rule "Add a Movement"
when
Item zwave_device_98f1144c_node4_alarm_motion changed from OFF to ON
then
m=m+1
Movements.sendCommand(m)
end
.sitemap
Text item=Movements label="Rörelser: [%.0f]"
In my event log file, I can see this:
2018-05-10 15:43:24.611 [vent.ItemStateChangedEvent] - zwave_device_98f1145c_node4_alarm_motion changed from OFF to ON
2018-05-10 15:43:25.162 [ome.event.ItemCommandEvent] - Item 'Movements' received command 1
How come it doesn’t show up in the BasicUI?
I have other similar rules (or maybe the rues work, but not the commands?), that have worked before, but have now stopped working, that looks like this:
rule "Olof connects"
when
Item Presence_Mobil_Olof changed from OFF to ON
then
Olof_ansluten.sendCommand(now.toString)
end
This rule used to present a date and time for when I last connected to the wifi, but now it doesn’t show up anymore. Just like the motion detection, it seems to work all the way up to actually showing the value in the BasicUI.
Thanks, but I don’t understand.
The Movements item I use in the rule is in the sitemap as I posted.
The item Olof_ansluten also exist in the sitemap even though I didn’t show it in the post.
The text shows up, but the value doesn’t.
The Olof_ansluten used to work, but it doesn’t anymore. I’m not sure if it stopped working when I went from v2.0 to 2.2 a couple of days ago or earlier.
Maybe off-topic, but I often (most of the time) need to refresh my browser to get any updates or even the status of contacts displayed correctly. Another way to try to get more details is to add logInfo commands and see in your logs what your rules actually do.
If your item’s label has a state presentation you have to define it in the items file.
In sitemap, label only alters the text part of the label.
So, define your item like this:
Remove the label parameter in the sitemap
It is defined in the item and you don’t need it
The sitemap one overrides the one in the item definition and you won’t see updates
You can also remove the icon parameter as you have defined it as <motion> in the item
.sitemap Text item=motionSensor valuecolor=["red"]
I define as much as possible in the item (Sitemap specific parameters like valuecolor obviously have to stay in the sitemap)
Oh God, this is really anoying.
Still no luck, even with all text to be presented defined in the items file.
And regarding just the text part of a label being updated when defined in the sitemap file, is that a new behaviour? I know for sure that my mobile ”presence” item has shown up with a datetime in the gui, even with the way I declared them before.
Ok, so the latest versions of my files (limited to one particular item):
.items
Number Movements "Rörelser: [%.0f]" <motion>
.sitemap
Text item=Movements
.rules
rule "Add a Movement"
when
Item zwave_device_98f1144c_node4_alarm_motion changed from OFF to ON
then
m=m+1
Movements.sendCommand(m)
end
log entry when me passing the sensor:
2018-05-11 08:13:45.500 [vent.ItemStateChangedEvent] - zwave_device_98f1144c_node4_alarm_motion changed from OFF to ON
2018-05-11 08:13:45.554 [ome.event.ItemCommandEvent] - Item 'Movements' received command 3
How should the String vs Number, %s vs %.0f and so on effect the outcome?
I’ve tried a lot of combinations since it’s not obvious to me how a counter should be handled.
Well, I have tried Chrome on PC and my Android phone, as well as on the iPad.
I can see that it refreshes, since I’ve broken things completely several times…
As I said, I have other items/rules that suddenly has stopped working as well, my “Olof Connects” rule in my first post for example.
I’m using an RPi3 B with an Aeotec z-stick gen 5, and the motion sensor is from Fibaro.
I just can’t see that there is anything but a silly detail that causes this, since the event log really says that my “end item” Movements actually gets the command…
I actually suspected you where getting to that comment now.
And the answer is “quite a while”, I don’t know exactly.
What I do know is that the uptime on the Pi were 238 days a couple of days ago…
Yes, but the other things that stopped working is sort of the same thing.
It’s three items that suddenly won’t display the text they’re given via a sendCommand() in the rules file.