Switch Device Configuration

Posted on
Mon Nov 02, 2020 1:45 am
mclass offline
Posts: 312
Joined: May 13, 2015
Location: Melbourne, Australia

Switch Device Configuration

Hi,

After wrestling for most of today, I have finally concluded that I need help!! :?

I am attempting to integrate a Deta double power outlet that has been flashed with Tasmota using MQTT Connect and Shims plugins

I have managed to get each switch under control as two separate devices, but have been unable to get the status of each switch to update.

I have attached screen shots of the device details from MQTT Explorer, and configuration windows for the Shims device, and of the broker (although I suspect thst hsving got the switches under control, the broker's OK).

All suggestions welcome, including changes to any of the bits I've got working already!!

If only there was a more simple and convenient Tasmota plug in .....

mclass
.
Attachments
Screenshot 2020-11-02 at 6.26.58 pm.png
Screenshot 2020-11-02 at 6.26.58 pm.png (127.02 KiB) Viewed 2174 times
Screenshot 2020-11-02 at 6.26.23 pm.png
Screenshot 2020-11-02 at 6.26.23 pm.png (194.82 KiB) Viewed 2174 times
Screenshot 2020-11-02 at 6.24.35 pm.png
Screenshot 2020-11-02 at 6.24.35 pm.png (71.73 KiB) Viewed 2174 times

Posted on
Mon Nov 02, 2020 3:00 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Switch Device Configuration

Hi,

I think this is related to the same issue I have that I was talking to Joe about but havent had time to follow up on. Can you show the device Custom States? What I have seen is that its the custom state that updates, but its not linked to the main Indigo state that you would expect.

Posted on
Mon Nov 02, 2020 3:55 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

In order for the Shims plugin to respond to the status type MQTT messages from the device, you need to have a trigger set up to queue those messages to the Shims plugin. Please show your trigger setup. That's the second screenshot section of https://github.com/FlyingDiver/Indigo-S ... asic-Setup

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 3:59 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

I also find it useful to enable debug logging on the MQTT Connector device so that I can see the exact topics and payloads that are received for each status update. Saving those to a text document for later reference is very useful. See the first code block in the Wiki article I just linked. Post those in this thread so we can see the exact data you're dealing with.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 5:22 am
mclass offline
Posts: 312
Joined: May 13, 2015
Location: Melbourne, Australia

Re: Switch Device Configuration

Thank you both for your prompt replies!

Can you show the device Custom States? What I have seen is that its the custom state that updates, but its not linked to the main Indigo state that you would expect.


See the attached screen shot - there don't appear to be any custom states for the switch devices.

In order for the Shims plugin to respond to the status type MQTT messages from the device, you need to have a trigger set up to queue those messages to the Shims plugin.


See the trigger configuration in the attached screenshot.

I also find it useful to enable debug logging on the MQTT Connector device so that I can see the exact topics and payloads that are received for each status update.


Here's a sample of the debug log when operating the switch from Indigo, and in response to actuation of the switch directly (pressing the button!). BTW, each device is called GPOx for "General Purpose Outlet" - not to be confused with Tasmota's GPIO's!!:

Code: Select all
2 Nov 2020 at 10:07:03 pm
   MQTT Shims                      Sent 'GPO1' On
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER1":"ON"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER1, payload: ON
   MQTT Shims                      Sent 'GPO1' Off
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER1":"OFF"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER1, payload: OFF

2 Nov 2020 at 10:07:27 pm
   MQTT Shims                      Sent 'GPO2' On
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER2":"ON"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER2, payload: ON
   MQTT Shims                      Sent 'GPO2' Off
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER2":"OFF"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER2, payload: OFF

2 Nov 2020 at 10:07:44 pm
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER1":"ON"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER1, payload: ON
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER1":"OFF"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER1, payload: OFF

2 Nov 2020 at 10:08:02 pm
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER2":"ON"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER2, payload: ON
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/RESULT, payload: {"POWER2":"OFF"}
   MQTT Connector Debug            Dalriada MQTT Broker: Message received: stat/tasmota_5854DC/POWER2, payload: OFF


I hope this extra info can provide you with a few more clues! As you can see from the time stamps in the log excerpt above, it's getting kind of late for me - and after trying to fathom this matter, my brain hurts!! :shock: Perhaps it'll all be clearer after a good night's sleep!!

Thanks again for your assistance!

mclass
Attachments
Screenshot 2020-11-02 at 10.20.17 pm.png
MQTT Trigger configuration
Screenshot 2020-11-02 at 10.20.17 pm.png (174.99 KiB) Viewed 2120 times
Screenshot 2020-11-02 at 9.47.20 pm.png
Device States - no custom states, even when attempting to scroll down
Screenshot 2020-11-02 at 9.47.20 pm.png (49.49 KiB) Viewed 2120 times

Posted on
Mon Nov 02, 2020 7:21 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

OK, I think I see the problem. It's ONE device, with ONE unique-ID, but there are two different state results, depending on which switch you're controlling. I'm not sure exactly how to handle this situation. I'll play around with it today and see what I come up with.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 7:47 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

Oh, one obvious thing that's wrong is your Shim device is defined to use Topic Field 2 for the Unique-ID component. It's actually field 1, since (as the note says) it's zero-based array numbering.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 7:58 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

The second problem is that you're looking at the Raw payload type, but not differentiating between the two topics, which tells you which outlet the status is for. There's two ways to deal with this, but switching to the JSON payload in the 'stat/tasmota_5854DC/RESULT' topic is easier, IMO.

Your connector setup is fine.

Your trigger needs to be:

Screen Shot 2020-11-02 at 8.54.20 AM.png
Screen Shot 2020-11-02 at 8.54.20 AM.png (602.67 KiB) Viewed 2087 times


Then the GPO1 device is:

Screen Shot 2020-11-02 at 8.55.35 AM.png
Screen Shot 2020-11-02 at 8.55.35 AM.png (640.33 KiB) Viewed 2087 times


GPO2 device is the same except for a Payload Key value of 'POWER2'.

I didn't set the proper Action Topic Template in this test device. Keep the one you have if it's working.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 5:21 pm
mclass offline
Posts: 312
Joined: May 13, 2015
Location: Melbourne, Australia

Re: Switch Device Configuration

Got it!! SIMPLES :lol:

Many thanks Joe for your rapid and effective response.

I thought it might be useful for others to have access to the Shims template for the double switch so they can avoid the time we've spent sorting this out:
Code: Select all
   ### MQTT Shims  Template for Deta 6922HA Wall Outlet   flashed with Tasmota:
                 
message_type: '##GPO##'
props:
    SupportsBatteryLevel: false
    SupportsEnergyMeter: false
    SupportsEnergyMeterCurPower: false
    SupportsOnState: true
    SupportsSensorValue: false
    SupportsStatusRequest: false
    action_template: cmnd/{{uniqueID}}/Power1
    off_action_payload: 'off'
    on_action_payload: 'on'
    shimSensorSubtype: Power
    state_location: payload
    state_location_payload_key: POWER1
    state_location_payload_type: json
    state_location_topic_field: '1'
    state_on_value: 'ON'
    status_action_payload: stat/tasmota_5854DC/POWER1
    status_action_template: stat/tasmota_5854DC/RESULT
    toggle_action_payload: toggle
    uid_location: topic
    uid_location_payload_key: '2'
    uid_location_topic_field: '1'
trigger:
    match_list: '["Match: stat", "Match: tasmota_5854DC", "Match: RESULT", "End: "]'
    queueMessage: true
type: shimRelay


Again, many thanks for the prompt and effective assistance for what was for me a quite complex process!

mclass

Posted on
Mon Nov 02, 2020 5:30 pm
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

A couple of other comments...

You don't need to subscribe to specific devices, especially if you have multiple ones. A subscription to "stat/#" will be sufficient for all of them.

If you have multiples of this exact same device, you could do your trigger more generically:

Code: Select all
    match_list: '["Match: stat", "Any", "Match: RESULT", "End: "]'


As long as the Unique ID field in the specific Shim device is correct, then this "just works". ;)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 02, 2020 6:11 pm
mclass offline
Posts: 312
Joined: May 13, 2015
Location: Melbourne, Australia

Re: Switch Device Configuration

Again, many thanks, Joe.

It is highly likely that I will deploy more of these devices - but I’m still trying to get my head around what’s going on with this one!!


Sent from my iPad using Tapatalk

Posted on
Mon Nov 02, 2020 7:14 pm
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Switch Device Configuration

Read the wiki article I linked, then ask away if you're still stuck.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests