Virtual switches and log entries

Does anyone know why virtual switches generate a log entry even if there is no state change? E.g.

  1. Virtual switch is off
  2. Simple rule runs and the condition evaluates to turn switch off
  3. Entry in log show virtual switch was turned off

I don't think normal switches behave this way (I have a physical switch that gets turned on/off with the virtual switch and I don't see entries for that) so was just wondering. My log was getting filled with virtual switch messages based on a illuminance changes. I was also seeing the same thing in the event messages published through the MakerAPI, so it doesn't appear to be a "logging" setting on the devices.

For now, I have moved this rule to RM from a simple automation rule and put in an "IF" condition to check the state of the virtual switch but was curious if this is the way it is supposed to work.

Do you have "Enable debug logging" and "Enable descriptionText logging" discabled?

I did have "Enable descriptionText logging" enabled for the virtual switch and all were off for the physical switch. The strange thing is that now I can't find the "false" events for the virtual switch (either in my log or in my database that captures the MakerAPI events). I must have been looking at something incorrectly - sorry about that. :anguished:

On a separate note, is there a way to have a rule execute only during a certain time (e.g. sunrise and sunset)? I think this is possible in simple automation rules using restrictions but I can't seem to find a way in RM. Currently, my RM rule is triggered by Lux readings and the IF statement checks if it is between two times (sunrise and sunset) and then turns on/off the lights.

It would appear that in the RM case, the rule would execute whenever a Lux reading changed (and then evaluate the conditions - time => sunrise +120 and time <= sunset -120, then lux <=20 or lux=>40) and in the simple automation case it would only execute between between the times defined in the "restrictions" and then evaluate the condition (lux <=20 or lux =>40).

Am I just overthinking this and it doesn't really matter? TIA

I would take the virtual bookcase lux out of the RM and create a simple rule to link it with the bookcase lamps. you can have it turn on with the bookcase lamps, and there's a checkbox to turn it off when closed/off. I use this for my contact sensor to control some lights

Either rule would work though. The only difference is you'll need to create 2 simple automations (one for <=20 and one for >=40), but both rules looks like they would be fine. Just know RM takes more processing power, so if it's a handful of rules you should be good, but if you expand your rulesets, the hub might take a hit

1 Like

Thanks - I originally created 2 simple automation rules (exactly like you suggested) but was trying RM to solve for (what I thought was a “fake”) multiple off events. I’m going to switch back and forth to confirm if I am getting unnecessary off events from the virtual device. If not, then I will switch back.

Re: Virtual Bookcase Lux - I’m using that to create my own log using Node-Red. I use the name of the virtual device to log it as an automation and the state (on or off) to log start or end.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.