Announcement

Collapse
No announcement yet.

MQTT event resets on power cycle.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MQTT event resets on power cycle.

    Having a weird situation. I am using mcsMQTT to control some RGB lights strips. Anyway, I have an event created to send them a command to dim at sunset, and brighten at sunrise. This works perfectly fine until I eventual get a power outage or have to cycle power on the HS3 server. Once it comes back up, every time, it changes my events to be the same in both cases. So I'm supposed to have an event to sets brightness to 255 and one that sets brightness to 150. After power cycle they both are set to 150. No idea why.

    I've added screenshots to show examples of what I'm talking about before and after.

    Before
    Click image for larger version

Name:	Screen Shot 2019-11-10 at 1.03.47 PM.png
Views:	93
Size:	193.7 KB
ID:	1339071

    After Power Cycle
    Click image for larger version

Name:	Screen Shot 2019-11-10 at 1.03.21 PM.png
Views:	60
Size:	237.5 KB
ID:	1339072

    Thanks!

    #2
    I will take a look at what makes events unique. It should not be doing what you have described. Are you using a current version of plugin from updater or an older one?

    Comment


      #3
      I ran a test and did not see anything unexpected. To support your investigation I prepared a version that outputs the event action initialization. Replace the attached with what is in your HS folder. In my test there were two events and the following shows in the HS log:

      Click image for larger version

Name:	Capture.PNG
Views:	90
Size:	21.1 KB
ID:	1339101

      Comment


        #4
        Hi,

        Thanks for responding so quickly. Yes, I'm using the latest version of the plugin and HS3. Updated in an attempt to fix this.

        I use your file and what was displayed during initialization was...

        04:35:47:3244:[Starting Plug-In]->Initializing plugin mcsMQTT ...
        04:35:47:6240:[mcsMQTT]->GetActions from Info UID=4114
        04:35:47:6307:[mcsMQTT]->Add_Update_Action Key=K41148, Message=xmastree/set={brightness:150}
        04:35:47:6358:[mcsMQTT]->GetActions from Info UID=7773
        04:35:47:6392:[mcsMQTT]->Add_Update_Action Key=K77736, Message=xmastree/set={effect:noise}
        04:35:47:6437:[mcsMQTT]->GetActions from Info UID=7773
        04:35:47:6471:[mcsMQTT]->Add_Update_Action Key=K77736, Message=xmastree/set={effect:solid}
        04:35:47:6522:[mcsMQTT]->GetActions from Info UID=7403
        04:35:47:6557:[mcsMQTT]->Add_Update_Action Key=K74037, Message=xmastree/set={color_temp:425}
        04:35:47:6596:[mcsMQTT]->Add_Update_Action Key=K41148, Message=xmastree/set={brightness:150}
        04:35:47:6692:[mcsMQTT]->Version 4.2.3.2 Registered with Homeseer
        04:35:48:8444:[Starting Plug-In]->Plugin mcsMQTT started successfully in 1519 milliseconds
        04:35:48:8618:[Starting Plug-In]->mcsMQTT loaded in 2504 milliseconds
        04:35:48:8631:[Plug-In]->Finished initializing plug-in mcsMQTT

        I should note. I didn't mention this before but I'm having the same problem with another two events that changes the lights from solid effect to noise effect. So you'll see those also in these results. Same problem with them as with the brightness.

        Thanks!

        Comment


          #5
          HS passes in to a plugin a byte stream that is the encoded representation of the event action. The plugin decodes the byte stream. Two parts of the stream are a unique identifier for the action and the text part of the action. In the following there are two event actions that HS tells the plugin about. One is about noise and one is about solid. The same unique ID (7773) is given for both. It is also the case that the event ID of 6 was used for both. I would expect both a different unique ID and a different event ID for these two event actions.

          04:35:47:6358:[mcsMQTT]->GetActions from Info UID=7773
          04:35:47:6392:[mcsMQTT]->Add_Update_Action Key=K77736, Message=xmastree/set={effect:noise}
          04:35:47:6437:[mcsMQTT]->GetActions from Info UID=7773
          04:35:47:6471:[mcsMQTT]->Add_Update_Action Key=K77736, Message=xmastree/set={effect:solid}

          Looking further the normal calling sequence in the plugin is GetActions and from there Add_Update_Action after the decoded data looks reasonable. In the sequence below Add_Update_Action was executed without a GetActions output line. This means that the plugin recognized the unique ID of 4114 for event id 8 had already been previously decoded so no need to decode again. This points to a similar problem as above where the unique ID and event ID are the same for two actions and this should not happen.

          04:35:47:6557:[mcsMQTT]->Add_Update_Action Key=K74037, Message=xmastree/set={color_temp:425}
          04:35:47:6596:[mcsMQTT]->Add_Update_Action Key=K41148, Message=xmastree/set={brightness:150}

          HS provides the action unique ID and the event ID so it looks as if the HS bookkeeping has an issue. What I suggest is the following
          1. Delete the events that use the xmastree messages. Disable, then reenable mcsMQTT. This will show a startup log where there should be no event actions for these in the log.
          2. Create the events from scratch with the desired event actions. Stop and start mcsMQTT. The new action information should be in the HS log. The expected output will be unique IDs for both events and actions.
          3. If step 2 looks normal then try to create the failure mode and repeat the mcsMQTT startup to record in the log.

          Comment


            #6
            I followed your steps and recreated those events from scratch (Didn't even use duplicate to help like last time). And now everything appears to be working great.

            When I initialize the mcsMQTT plugin I now get...

            07:10:38:1268:[mcsMQTT]->GetActions from Info UID=3241
            07:10:38:1334:[mcsMQTT]->Add_Update_Action Key=K32416, Message=xmastree/set={brightness:255}
            07:10:38:1376:[mcsMQTT]->GetActions from Info UID=6420
            07:10:38:1410:[mcsMQTT]->Add_Update_Action Key=K64207, Message=xmastree/set={brightness:150}
            07:10:38:1449:[mcsMQTT]->GetActions from Info UID=3633
            07:10:38:1483:[mcsMQTT]->Add_Update_Action Key=K36338, Message=xmastree/set={effect:noise}
            07:10:38:1522:[mcsMQTT]->GetActions from Info UID=3616
            07:10:38:1555:[mcsMQTT]->Add_Update_Action Key=K36169, Message=xmastree/set={effect:solid}
            07:10:38:1593:[mcsMQTT]->GetActions from Info UID=5648
            07:10:38:1625:[mcsMQTT]->Add_Update_Action Key=K56489, Message=xmastree/set={color_temp:425}

            ...Which looks much more like how you described it should look.

            Thanks again for all of your help. I am again super impressed with the HomeSeer community.

            Comment

            Working...
            X