Tasmota UK Mains Plug settings

Posted on
Thu Mar 25, 2021 7:57 am
CliveS offline
Posts: 770
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Tasmota UK Mains Plug settings

I have finally found a reliable UK 240v Tasmota based mains plug and via MQTTConnector and Shims installed it.

I can turn it on and off but have run out of ideas how to get the Indigo UI state to change from Off to On as I just cannot get my head around what is needed.

Also Energy, Power key settings and 'Send Status Request' have defeated me.

Tasmota1.jpg
Tasmota1.jpg (19.39 KiB) Viewed 2991 times


STATE = {“Time":"2021-03-25T14:19:57","Uptime":"0T02:45:10","UptimeSec":9910,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"Highsteads_AC","BSSId":"F0:9F:C2:2A:07:83","Channel":1,"RSSI":100,"Signal":-33,"LinkCount":1,"Downtime":"0T00:00:03"}}

SENSOR =
{"Time":"2021-03-25T14:19:57","ENERGY"{"TotalStartTime":"2021-03-24T14:28:10","Total":0.374,"Yesterday":0.227,"Today":0.147,"Period":3,"Power":33,"ApparentPower":44,"ReactivePower":30,"Factor":0.74,"Voltage":247,"Current":0.180}

Tasmota2.jpg
Tasmota2.jpg (76.64 KiB) Viewed 2991 times

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Thu Mar 25, 2021 8:42 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

Your payload type is JSON, not Raw. Once you fix that, then you can set the payload key to "POWER". Then you need to make sure you have the trigger set up properly for the topic. That should fix getting the plugin device to sync with the actual device.

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

Posted on
Thu Mar 25, 2021 8:51 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

Getting the energy readings out will require a separate Shim device, since the data is sent using a different topic. Use a Value Sensor device and set the multi-states key to ENERGY.

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

Posted on
Thu Mar 25, 2021 8:55 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

It's a lot easier to decipher this stuff if you use the complete topic and format the payload for readability:

Code: Select all
Tasmota/Test-Room/tele/STATE =>
{
    “Time":"2021-03-25T14:19:57",
    "Uptime":"0T02:45:10",
    "UptimeSec":9910,
    "Heap":25,
    "SleepMode":"Dynamic",
    "Sleep":50,
    "LoadAvg":19,
    "MqttCount":1,
    "POWER":"ON",
    "Wifi":
    {
        "AP":1,
        "SSId":"Highsteads_AC",
        "BSSId":"F0:9F:C2:2A:07:83",
        "Channel":1,
        "RSSI":100,
        "Signal":-33,
        "LinkCount":1,
        "Downtime":"0T00:00:03"
    }
}


Code: Select all
Tasmota/Test-Room/tele/SENSOR =>
{
    "Time":"2021-03-25T14:19:57",
    "ENERGY":
    {
        "TotalStartTime":"2021-03-24T14:28:10",
        "Total":0.374,
        "Yesterday":0.227,
        "Today":0.147,
        "Period":3,
        "Power":33,
        "ApparentPower":44,
        "ReactivePower":30,
        "Factor":0.74,
        "Voltage":247,
        "Current":0.180
    }
}

I'm hoping that you did a bad copy and paste on that SENSOR payload, because what you posted is missing a ":" after "ENERGY" and a final "}". If the payload is actually missing those characters you've got real problems with that payload.

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

Posted on
Thu Mar 25, 2021 10:00 am
CliveS offline
Posts: 770
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Tasmota UK Mains Plug settings

FlyingDiver wrote:
Your payload type is JSON, not Raw. Once you fix that, then you can set the payload key to "POWER". Then you need to make sure you have the trigger set up properly for the topic. That should fix getting the plugin device to sync with the actual device.


I did try JSON but got the same problem and yes it was a bad copy and paste on the SENSOR payload.

I have included a log of me just clicking Turn On and Turn Off, with a few seconds delay between each click.

Code: Select all
   MQTT Shims Debug                Tasmota-Plug-1: publish_topic: Tasmota/Test-Room/cmnd/POWER -> off
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   MQTT Shims Debug                Tasmota-Plug-1: processMessages: '##tasmota##' Tasmota/Test-Room/stat/RESULT -> {"POWER":"OFF"}
   MQTT Shims Debug                Tasmota-Plug-1: update topic message_address = Test-Room
   MQTT Shims Debug                Tasmota-Plug-1: update state_location_payload, key = POWER
   MQTT Shims Debug                recurseDict key_string = POWER, data_dict= {u'POWER': u'OFF'}
   MQTT Shims Debug                Tasmota-Plug-1: shimRelay, state_key = POWER, state_data = {u'POWER': u'OFF'}, value = OFF
   MQTT Shims Debug                Tasmota-Plug-1: Updating state to False
   MQTT Shims Debug                Tasmota-Plug-1: publish_topic: Tasmota/Test-Room/cmnd/POWER -> on
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   Trigger                         Tasmota Trigger
   MQTT Shims Debug                received notification of MQTT message type ##tasmota## from Indigo MQTT Server
   MQTT Shims Debug                Tasmota-Plug-1: processMessages: '##tasmota##' Tasmota/Test-Room/cmnd/POWER -> on
   MQTT Shims Debug                Tasmota-Plug-1: update topic message_address = Test-Room
   MQTT Shims Debug                Tasmota-Plug-1: JSON decode error for state_location = payload, aborting

25 Mar 2021 at 15:44:50
   MQTT Shims                     
message_type: '##tasmota##'
props:
    SupportsOnState: true
    action_template: Tasmota/Test-Room/cmnd/POWER
    off_action_payload: 'off'
    on_action_payload: 'on'
    shimSensorSubtype: Power
    state_location: payload
    state_location_payload_key: POWER
    state_location_payload_type: json
    state_location_topic_field: '0'
    state_on_value: 'on'
    toggle_action_payload: toggle
    uid_location: topic
    uid_location_topic_field: '1'
trigger:
    match_list: '["Match: Tasmota", "Any: "]'
    queueMessage: true
type: shimRelay

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Thu Mar 25, 2021 10:14 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

Your trigger is wrong. You're matching on any message from the Tasmota, but you need a trigger (and message type) specifically for the two topics that have data you want, which are:

Tasmota/Test-Room/tele/STATE
Tasmota/Test-Room/tele/SENSOR

You're getting errors because the trigger is matching on the on/off command you're sending TO the device (which the broker is echoing back to Indigo).

You can see in the log that when you sent the OFF command, the plugin did update the state to off (False).

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

Posted on
Thu Mar 25, 2021 10:16 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

It also usually helps to turn on debug logging for the Connector plugin, so that you can see what messages it's processing and queueing.

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

Posted on
Fri Mar 26, 2021 10:30 am
CliveS offline
Posts: 770
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Tasmota UK Mains Plug settings

FlyingDiver wrote:
Your trigger is wrong. You're matching on any message from the Tasmota, but you need a trigger (and message type) specifically for the two topics that have data you want, which are:

Tasmota/Test-Room/tele/STATE
Tasmota/Test-Room/tele/SENSOR

You're getting errors because the trigger is matching on the on/off command you're sending TO the device (which the broker is echoing back to Indigo).

You can see in the log that when you sent the OFF command, the plugin did update the state to off (False).


I think I have sorted all that and now find after further digging

I have two triggers set for when the plug turns on or off

Trigger 1 on Tasmota/Test-Room/stat/Any

"Any" "of the following rules are true"
"If device" "Tasmota-Plug-1" "On/Off State" "is on"
Then
Write to Log
###### ON ###### ON ###### ON ###### ON ###### ON #######

and

Trigger 2 on Tasmota/Test-Room/stat/Any

"Any" "of the following rules are true"
"If device" "Tasmota-Plug-1" "On/Off State" "is off"
Then
Write to Log
###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

I can never get the On to trigger.

I added a couple of indigo.server.log lines in the shims code and found that pressing either on or off always triggered OFF and many of the Trigger/Actions clicks did not get MQTT Shims response.

When it did turn On eventually the updateStateImageOnServer was still False.

The ‘custom states Power=‘ mostly mimicked the real state but not always, but clicking on or off did turn the plug on and off 100% of the time.

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######
MQTT Shims value = self.recurseDict(state_key, state_data) = OFF
MQTT Shims updateStateImageOnServer = False

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######
MQTT Shims value = self.recurseDict(state_key, state_data) = ON
MQTT Shims updateStateImageOnServer = False

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######
MQTT Shims value = self.recurseDict(state_key, state_data) = ON
MQTT Shims updateStateImageOnServer = False

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

Trigger Tasmota/Test-Room/stat off
Action Collection ###### OFF ###### OFF ###### OFF ###### OFF ###### OFF #######

26 Mar 2021 at 16:27:14
MQTT Shims
message_type: '##tasmota-stat##'
props:
SupportsOnState: true
action_template: Tasmota/Test-Room/cmnd/POWER
brightness_scale: '100'
dimmer_action_payload: '{''turn'': ''on'', ''brightness'': {{brightness}} }'
off_action_payload: 'off'
on_action_payload: 'on'
shimSensorPrecision: '2'
shimSensorSubtype: Power
state_dict_payload_key: .
state_location: payload
state_location_payload_key: POWER
state_location_payload_type: json
state_location_topic_field: '0'
state_on_value: '1'
toggle_action_payload: toggle
uid_location: topic
uid_location_topic_field: '1'
trigger:
match_list: '["Match: Tasmota", "Match: Test-Room", "Match: stat", "Any: "]'
queueMessage: true
type: shimRelay

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Mar 26, 2021 10:38 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

Please turn on debug logging for both the Connector and Shims plugins and post that. I need to see the actual topics and payloads as the plugin sees them.

I suspect that the problem is this:

Code: Select all
state_on_value: '1'


You have it configured to turn on the Shim device when it receives a value "1" in the payload. I suspect you're never actually getting that value.

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

Posted on
Fri Mar 26, 2021 10:48 am
CliveS offline
Posts: 770
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Tasmota UK Mains Plug settings

FlyingDiver wrote:
Please turn on debug logging for both the Connector and Shims plugins and post that. I need to see the actual topics and payloads as the plugin sees them.

I suspect that the problem is this:

Code: Select all
state_on_value: '1'


You have it configured to turn on the Shim device when it receives a value "1" in the payload. I suspect you're never actually getting that value.


I have no idea where state_on_value is set. I will turn on both debugs (I could be a long time as it just scrolls constantly)

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Mar 26, 2021 10:51 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

CliveS wrote:
I have no idea where state_on_value is set. I will turn on both debugs (I could be a long time as it just scrolls constantly)
Attachments
Screen Shot 2021-03-26 at 12.49.50 PM.png
Screen Shot 2021-03-26 at 12.49.50 PM.png (89.16 KiB) Viewed 2899 times

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

Posted on
Fri Mar 26, 2021 10:58 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

CliveS wrote:
I will turn on both debugs (I could be a long time as it just scrolls constantly)


Scrolls constantly? With MQTT messages? Or other stuff? I would recommend turning off as much stuff as you can while you're trying to get this working. Maybe even remove some of your topic subscriptions which aren't needed for the specific devices you're working on.

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

Posted on
Fri Mar 26, 2021 11:21 am
CliveS offline
Posts: 770
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Tasmota UK Mains Plug settings

FlyingDiver wrote:
CliveS wrote:
I will turn on both debugs (I could be a long time as it just scrolls constantly)


Scrolls constantly? With MQTT messages? Or other stuff? I would recommend turning off as much stuff as you can while you're trying to get this working. Maybe even remove some of your topic subscriptions which aren't needed for the specific devices you're working on.


Joe,
I removed the '1', (trying 1,true,on and forgot to remove it!) and it is now all working, thank you and my apologies for waisting you time.
As for the scrolling, that was with Verbose debug on, I take it you only really need normal debug. (but not now required)

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Mar 26, 2021 11:31 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Tasmota UK Mains Plug settings

CliveS wrote:
I removed the '1', (trying 1,true,on and forgot to remove it!) and it is now all working, thank you and my apologies for waisting you time.
As for the scrolling, that was with Verbose debug on, I take it you only really need normal debug. (but not now required)


Correct, the "detailed debugging" is really only there for plugin development. I almost never tell someone to turn that one, but people do anyway. ;)

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

Posted on
Sat Mar 27, 2021 3:38 am
Colly offline
Posts: 535
Joined: Jan 16, 2016
Location: Ireland

Re: Tasmota UK Mains Plug settings

Hi Clive,
Would you mind sharing a link to the plug you’re using?

Who is online

Users browsing this forum: No registered users and 2 guests

cron