rule "Occupancy Test"
when
Item JMHomekit received update
then
switch JMHomekit.state
{
case ON :
{
postUpdate(JMsHome,"Home")
}
case OFF :
{
sendCommand(JMsHome,"Away")
}
}
end
HomeKit updates JMHomekit which is an ON/OFF type item and the above rule updates the JMsHome item accordingly. After activating the rule, the sitemap doesn’t display the item state. If i go into the console and use smarthomestatus JMsHome it says: Home. The logs show no errors, they verify the rule is in fact running and they show the item state being updated accordingly (home or away).
I originally just had JMHomekit and used mappings to make it say ‘Home’ or ‘Away’ on the sitemap but i didn’t like how i could click the buttons, changing the item state. This is why i chose to create the text item JMsHome to display a message i couldn’t change.
I want it to look like this but cant get the state to show on the right side where Carrie Underwood is:
You might try to change the description to String JMsHome "JM [%s]" <man_3>
I‘ve seen in your rule you are using a mix of postUpdate and sendCommand. And you are using the generic methods.
Probably not the root cause for your issue but worth to have a look here postUpdate vs. sendCommand
Hey thanks for the reply. I’ll try making that change and let you know how it works. For my own knowledge, what does the %s do?
Regarding the rule, that was my bad. I originally tried postUpdate which didn’t work then I tried sendCommand which also didn’t work. When I copied this rule to post here, I meant to change both back to postUpdate but missed one. I never ran the rule like that where one is post update and the other is sendCommand.
Hey thank you both for posting and providing that information. Adding the [%s] to my item and using postUpdate solved my problem:
Item file
String JMsHome “JM [%s]” <man_3>
Also wanted to post a workaround that might help someone else out reading this if for some reason the above solution isn’t acceptable. Before i tried the above solution, I made the below dummy items:
for those not aware, the visibility tag above basically hides the ‘incorrect’ item according to how JMHomekit is set. When JMHomekit is on, the item JMsAway is hidden but JMsHome is shown and visa versa.