Dimmer Value Issue - Changes to incorrect value

Hello,

I’m experiencing odd behavior with a dimmer item I have created. No matter what value I change the dimmer to, openHAB immediately sets it back to “15.”

I do have another rule where if another on/off switch item is ON, than it should set this dimmer to 15, but that switch is OFF and it is still setting the value to 15. Also, I have tried completely removing that rule and it still wants to set this value to 15. Here are more details from my log:

2020-06-26 15:44:41.121 [ome.event.ItemCommandEvent] - Item 'Volume_Everywhere' received command 30
2020-06-26 15:44:41.122 [nt.ItemStatePredictedEvent] - Volume_Everywhere predicted to become 15
00] /var/log/openhab2/events.log                                                                     

The purpose of these items/rules is to allow for a “Night Mode” on my Echo Dots for Alexa TTS, so that if “NightMode” is “ON,” she will only speak at volume 15/100. But if it is OFF, she should speak at whatever value the volume is set to. I have “NightMode” currently “OFF” but for some reason the master volume item, “Volume_Everywhere” keeps changing itself back to 15, no matter what I do. This was working fine for the longest time, but suddenly has stopped working.

Here are the rules for these items:

rule "NightMode_ON"
when
   Item NightMode received command ON
then
   Volume_Everywhere.sendCommand(15)
   Speak_Volume_Everywhere.sendCommand(15)
end

rule "NightMode_OFF"
when
   Item NightMode received command OFF
then
   // Volume_Everywhere.sendCommand(40)
   // Speak_Volume_Everywhere.sendCommand(40)
end

rule "SayIt"
when
   Item TTS_Broadcast received update
then
   if (NightMode.state == OFF) {
      val ttstalk = TTS_Broadcast.state.toString()
      createTimer(now.plusSeconds(1),  [ |
         Upstairs_Den_Speak.sendCommand(ttstalk)
         Fire1_Speak.sendCommand(ttstalk)
         Upstairs_Bathroom_Speak.sendCommand(ttstalk)
         Kitchen_Speak.sendCommand(ttstalk)
         Living_Room_Speak.sendCommand(ttstalk)
         Upstairs_Bedroom_Speak.sendCommand(ttstalk)
         Foyer_Speak.sendCommand(ttstalk)
         FireTV_Upstairs_Den_Speak.sendCommand(ttstalk)
         Winlexa_Speak.sendCommand(ttstalk)
         Music_Room_Speak.sendCommand(ttstalk)
      ])
   }
   if (NightMode.state == ON) {
      Volume_Everywhere.sendCommand(15)
      Speak_Volume_Everywhere.sendCommand(15)
      createTimer(now.plusSeconds(1),  [ |
         val ttstalk = TTS_Broadcast.state.toString()
         Upstairs_Den_Speak.sendCommand(ttstalk)
         Fire1_Speak.sendCommand(ttstalk)
         Upstairs_Bathroom_Speak.sendCommand(ttstalk)
         Kitchen_Speak.sendCommand(ttstalk)
         Living_Room_Speak.sendCommand(ttstalk)
         Upstairs_Bedroom_Speak.sendCommand(ttstalk)
         Foyer_Speak.sendCommand(ttstalk)
         FireTV_Upstairs_Den_Speak.sendCommand(ttstalk)
         Winlexa_Speak.sendCommand(ttstalk)
         Music_Room_Speak.sendCommand(ttstalk)
      ])
   }        
end

Edit: I did look at this thread as well as this thread, but could not find any information that seemed to be helpful for my current issue.

May we know the definition of your Volume_Everywhere Item, is it linked to any bindings? (they get a say about autoupdate’s predictions too)
Where does this command 30 come from?

I think it is more a case of it never changing away from 15, i.e. the command is not triggering autoupdate as you expect (which I presume you normally rely on to make a state change)

I’m quite curious about this - never seen autoupdate make a prediction not directly derived from command. As opposed to simply not doing it at all.

1 Like

Were you editing the rules? When you removed the one rule that sets it to 15, then did you immediately test it? sometime when you are making fast edits like that, things to get stuck, maybe holding the old rule in memory and restarting OpenHAB gets the rules reloaded and it works.

1 Like

Hello :blush:

Volume_Everywhere is just a simple dimmer item that was created through PaperUI. I just checked and it is not linked to anything else, nor linked or connected to any bindings. I simply went into the Configuration area of PaperUI, then to Items --> clicked the + sign to add a new item, named it “Volume_Everywhere” and labeled it “Volume_Everywhere.” I don’t believe it is connected to any bindings or any other items.

I searched through my openHAB files in Visual Studio Code to see if perhaps there was a rule somewhere referencing it, but the only rules I found are the ones I posted above, and also an Echo/Alexa “LastVoiceCommand” connected rule that I have for Alexa, which I’ll explain better /show my rule below. The “Volume_Everywhere” item is set for persistence with mapdb, if that makes a difference perhaps? I tried just now removing the persistence for that item to test, but it still didn’t seem to matter.

The “30” value was assigned by giving Alexa the command “Alexa, house volume 3” and she sets the dimmer to 30 out of 100. But I’ve also changed the "Volume_Everywhere value other ways, such as by using a slider on a HABPanel dashboard or by using an HTTP API, such as by going to the URL:
http://localhost:8080/classicui/CMD?Volume_Everywhere=30
or
http://localhost:8080/basicui/CMD?Volume_Everywhere=30

It doesn’t matter what value I set it to, for some reason it keeps reverting to 15. Even if I delete the “Volume_Everywhere” item, the log shows that it wants to set the non-existing item “Volume_Everywhere” to 15.

As for the Alexa volume command rules I mentioned above, I have a rule which takes certain volume-related voice commands from my Echo Dots and then openHAB is supposed to set the volume accordingly. And that part is working - you can see where it does set the volume to the correct level, but then for some reason the system reverts it back to 15 every single time. I’ll include this rule below, where I can request that Alexa set the volume level anywhere between 0 and 10, and then openHAB adjusts (well, it’s supposed to anyway/used to without issue) the “Volume_Everywhere” item value accordingly. Here is the code for this rule:

rule "AlexaMasterVolumeSetting"
when 	
  Item LastVoiceCommand_Everywhere received update
then	
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to low")) {
        Volume_Everywhere.sendCommand(5)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("low volume")) {
        Volume_Everywhere.sendCommand(5)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("quiet volume")) {
        Volume_Everywhere.sendCommand(5)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("volume quiet")) {
        Volume_Everywhere.sendCommand(5)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to zero")) {
        Volume_Everywhere.sendCommand(0)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to one")) {
        Volume_Everywhere.sendCommand(10)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to two")) {
        Volume_Everywhere.sendCommand(20)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to three")) {
        Volume_Everywhere.sendCommand(30)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to four")) {
        Volume_Everywhere.sendCommand(40)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to five")) {
        Volume_Everywhere.sendCommand(50)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to six")) {
        Volume_Everywhere.sendCommand(60)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to seven")) {
        Volume_Everywhere.sendCommand(70)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to eight")) {
        Volume_Everywhere.sendCommand(80)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to nine")) {
        Volume_Everywhere.sendCommand(90)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("set the volume everywhere to ten")) {
        Volume_Everywhere.sendCommand(100)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume zero")) {
        Volume_Everywhere.sendCommand(0)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume one")) {
        Volume_Everywhere.sendCommand(10)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume two")) {
        Volume_Everywhere.sendCommand(20)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume three")) {
        Volume_Everywhere.sendCommand(30)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume four")) {
        Volume_Everywhere.sendCommand(40)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume five")) {
        Volume_Everywhere.sendCommand(50)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume six")) {
        Volume_Everywhere.sendCommand(60)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume seven")) {
        Volume_Everywhere.sendCommand(70)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume eight")) {
        Volume_Everywhere.sendCommand(80)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume nine")) {
        Volume_Everywhere.sendCommand(90)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("house volume ten")) {
        Volume_Everywhere.sendCommand(100)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume zero")) {
        Speak_Volume_Everywhere.sendCommand(0)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume one")) {
        Speak_Volume_Everywhere.sendCommand(10)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume two")) {
        Speak_Volume_Everywhere.sendCommand(20)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume three")) {
        Speak_Volume_Everywhere.sendCommand(30)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume four")) {
        Speak_Volume_Everywhere.sendCommand(40)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume five")) {
        Speak_Volume_Everywhere.sendCommand(50)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume six")) {
        Speak_Volume_Everywhere.sendCommand(60)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume seven")) {
        Speak_Volume_Everywhere.sendCommand(70)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume eight")) {
        Speak_Volume_Everywhere.sendCommand(80)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume nine")) {
        Speak_Volume_Everywhere.sendCommand(90)
    }
    if (LastVoiceCommand_Everywhere.state.toString.startsWith ("speak volume ten")) {
        Speak_Volume_Everywhere.sendCommand(100)
    }
end

As you can see, I also have a separate “master” “Speak_Volume_Everywher” item, for the Alexa/Echo “Speak_Volume” levels, and it is not working for these items either. All of this used to work without issue and I didn’t make any changes…

Here is the error for the “Speak_Volume_Everywhere” not working properly when I just gave Alexa the command “Alexa, speak volume five.”

2020-06-26 17:31:50.770 [vent.ItemStateChangedEvent] - LastVoiceCommand_Everywhere changed from turn off the upstairs den lamp to speak volume five
2020-06-26 17:31:50.772 [vent.ItemStateChangedEvent] - Upstairs_Den_LastVoiceCommand changed from turn off the upstairs den lamp to speak volume five
2020-06-26 17:31:50.783 [ome.event.ItemCommandEvent] - Item 'SpokeLast' received command Upstairs_Den_LastVoiceCommand
2020-06-26 17:31:51.211 [ome.event.ItemCommandEvent] - Item 'Speak_Volume_Everywhere' received command 50
2020-06-26 17:31:51.214 [nt.ItemStatePredictedEvent] - Speak_Volume_Everywhere predicted to become NULL

I will try cleaning cache and restarting/rebooting and see if that helps…

Edit: Nope… still not working :-/

I also tried turning on TRACE logging for the AmazonEchoControl binding and watched it to see if anything odd was happening with the binding possibly reverting the value back, but nope… it’s openHAB that is doing it, somewhere/somehow…

I don’t think the cache clear is needed and will result in a slow start up which usually causes some (sometimes a lot) of weird errors and sometimes another restart or two is needed because of well know issue with start up load order loading rules before items needed by said rules are loaded.
In my experience, just restarting OpenHAB (not even the host, just OpenHAB) clears the rules out of memory and loads them a fresh

Is

a group?

What turns

NightMode

on and off?

Please show us this bit of magic!
I’m fairly certain you have a ghostly link somewhere.
Could be a ghostly rule, but I doubt this because rules cannot influence autoupdate. Issuing a command and getting an unconnected prediction is weird.
Issuing a command and getting a NULL prediction is less unexpected, it generally indicates a broken link, or offline Thing, or command unsuitable for Item - i.e. a “That can’t happen” response.

1 Like

Not a group, no. Any time one of the specific Echo Dot’s “LastVoiceCommand” is updated, that value is pushed to “LastVoiceCommand_Everywhere,” and is used in a number of rules.

Here’s a HABPanel table I made which shows this a little better which I use for debugging and whatnot.

So are all these items created in Paper user interface?

What Ross is asking is for you to show us the items, if they are Paper UI created, I guess a screen shot or something

:+1: I’m agreeing with this

Nope, probably no you are right

1 Like

I either turn it on or off manually (it’s an item created using the Hue Emulation binding), or there is also a rule using the Next-Generation rule system/Flows Builder GUI binding which turns it on at 10 PM and off at 9 AM.

I’ve definitely had issues with ghost items in the past! The work-around (without knowing how to properly remove a ghost item) for me was to just re-create the item but with a new name. I can try that!

But here are some screenshots. If I didn’t capture the right screen, I’m happy to take more! :blush: Thank you for your help!

Here is the item in PaperUI

And here is the detail view of the Volume_Everywhere item.

When I go into Visual Studio Code and use Edit --> Find in Files feature and find all instances of “Volume_Everywhere” in my .rules files, and then toggle all of those rules to be commented out and save, I still get the weird ghost behavior of the system trying to set the item to a different amount.

Here’s where I used the web HTTP API to set the value of Volume_Everywhere (with no rules or linked items connected to it - should just be a simple dimmer item) to “20”.

And then you can see in the log where it immediately removed my value of “20” and set it to “NULL.”

It was setting it to “15” every time, but now it seems after cleaning cache and rebooting multiple times, now it just wants to set it to “NULL.”

I may try re-creating that dimmer item with a new name now and seeing if that makes a difference…

Sure enough - problem solved! :heavy_check_mark:

I created a new “NewVolume_Everywhere” dimmer item in PaperUI.

And then I updated my volume rule in Visual Studio Code to set this new “NewVolume_Everywhere” item instead of the old “Volume_Everywhere.”

And now when I say “Alexa, house volume two” she properly sets all of my Echo Dot devices to volume 2. :heavy_check_mark: :slight_smile:

So it seems it was an issue with a ghost item. Is there any proper way to fix those?? :thinking:

Man they sure are annoying to debug/troubleshoot, haha.

Edit: probably also worth mentioning… I have a couple of dashboards in HABPanel that are also connected to that “Volume_Everywhere” value. I don’t know if that can lead to ghost items or not…
Going back in now to connect everything to my “NewVolume_Everywhere” item in HABPanel.

1 Like

Thank you again @rossko57 and @Andrew_Rowe for your help! I just wanted to ask you if you had any advice/guidance for dealing with “ghost items?” Is there any way to dive deep inside openHAB/the runtime/server and find the ghost items somehow? Or is this not really possible?

1 Like

I’ve done some experiments here with autoupdate …

It will give a non-obvious response if an Item is linked to a broken channel (e.g. non-existent)
openHAB makes the reasonable assumption “that command cannot work!”
autoupdate action in that situation becomes “then the state won’t change”, and the effect we see of that is a logged prediction for the existing value.

1 Like