Sonoff dimmer control with MQTT Shims

Posted on
Sun Jan 10, 2021 9:00 am
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Sonoff dimmer control with MQTT Shims

I feel embarrassed to ask but cannot see how to do it

Up to now I have implemented several devices but none with a variable like a dimmer.

Attached is the setup for Study Lamp.

From the main panel selecting turn on of off switches the lamp but the dimmer slider does nothing.
If on the device I set the dimmer action payload to a number between 1 and 100 this correctly sets when the lamp is switched so how do I get the slider to input the value to the device.

I am sure once explained once it will be obvious.

Sending commands directly to the broker works fine

Thanks in advance for your help


BTW the dimmer is a sonoff D1 flashed with Tasmota 9.2
Attachments
Screenshot 2021-01-07 at 08.11.21.jpg
Screenshot 2021-01-07 at 08.11.21.jpg (494.73 KiB) Viewed 3512 times

Posted on
Sun Jan 10, 2021 9:11 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

wasimpson wrote:
From the main panel selecting turn on of off switches the lamp but the dimmer slider does nothing.
If on the device I set the dimmer action payload to a number between 1 and 100 this correctly sets when the lamp is switched so how do I get the slider to input the value to the device.


What do you mean by "If on the device I...."? What UI are you using?

What's the exact command you send to the broker to set the brightness value?

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

Posted on
Wed Jan 13, 2021 5:34 am
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Thanks for the prompt reply
From the indigo device panel i naively assumed i could select, in my case study lamp, and toggle the power and dimmer settings from the option at the bottom of the device panel.
Switching the power works but not the dimmer.
Maybe an issue with my dimmer device settings?

I proved i can talk to the dimmer via the terminal window
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Power -m on
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Dimmer -m 10
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Dimmer -m 100

Which work fine

Help with the indigo setup would be appreciated

Regards
Bill

Posted on
Wed Jan 13, 2021 7:59 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

wasimpson wrote:
Thanks for the prompt reply
From the indigo device panel i naively assumed i could select, in my case study lamp, and toggle the power and dimmer settings from the option at the bottom of the device panel.
Switching the power works but not the dimmer.
Maybe an issue with my dimmer device settings?

I proved i can talk to the dimmer via the terminal window
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Power -m on
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Dimmer -m 10
Williams-Mac-mini:~ Smedia$ mosquitto_pub -h 192.168.2.151 -t cmnd/Study_Lamp/cmnd/Dimmer -m 100

Which work fine

Help with the indigo setup would be appreciated

Regards
Bill


The topics you show in the commands above do not match what you show in the screenshot. Check your settings for the "On/Off Action Topic" and the "Dimmer Action Topic".

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

Posted on
Wed Jan 13, 2021 12:54 pm
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Thanks very much
Cracked

Posted on
Sat Jan 16, 2021 10:41 am
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

I have a last issue i cannot crack.
How do i get the state to be correctly reflected?
I have a trigger component with STATE and RESULT but i am obviously missing something

Thanks in advance
Attachments
Screenshot 2021-01-16 at 17.23.24.jpg
Screenshot 2021-01-16 at 17.23.24.jpg (419.6 KiB) Viewed 3394 times

Posted on
Sat Jan 16, 2021 11:09 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

The state value for the lamp is not in the topic, it's in the payload. The topic is going to be 'tele/Study_Lamp/STATE', but I can't see the entire payload to see what it's called there.

So at a minimum you need to change the "State Value Location" to "Payload", then put in a key value (which I can't see). You also need to make sure that you have a trigger for the 'tele/Study_Lamp/STATE' topic that matches the '##SONOFF##" message type.

Have you gone through all the steps in the basic guide? https://github.com/FlyingDiver/Indigo-S ... asic-Setup

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

Posted on
Sun Jan 17, 2021 10:31 am
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Thanks for the update.
Yes i have looked at the basic guide
I still cant get my head around how to use the payload as from the device you get an array of all the parameters.
See attached a couple more pictures so you can hopefully point me in the right direction

Thanks again for your help so far
Attachments
Screenshot 2021-01-17 at 17.15.26.jpg
Screenshot 2021-01-17 at 17.15.26.jpg (475.12 KiB) Viewed 3345 times
Screenshot 2021-01-17 at 17.14.48.jpg
Screenshot 2021-01-17 at 17.14.48.jpg (472.83 KiB) Viewed 3345 times

Posted on
Sun Jan 17, 2021 10:39 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

I can't read those screen shots at all.

Please copy and paste the status update topic and payload into this thread. Text, not image.

And use the "Write Device Template to Log" menu command to get the Shim device definition and then copy that to a reply as well.

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

Posted on
Mon Jan 18, 2021 11:12 am
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Ah i assumed images were attachments.

Status update topic
tele/Study_Lamp/STATE

Payload i guessed
{{POWER,Dimmer}}


message_type: '##SONOFF##'
props:
SupportsSensorValue: true
SupportsStatusRequest: true
action_template: cmnd/{{uniqueID}}/cmnd/Power
brightness_scale: '100'
dimmer_action_payload: '{{brightness}} '
dimmer_action_template: cmnd/{{uniqueID}}/cmnd/Dimmer
off_action_payload: 'off'
on_action_payload: 'on'
state_location: payload
state_location_payload_key: POWER,Dimmer
state_location_payload_type: raw
state_location_topic_field: '1'
status_action_payload: '{{POWER,Dimmer}}'
status_action_template: tele/{{uniqueID}}/STATE
uid_location: topic
uid_location_payload_key: RESULT
uid_location_topic_field: '1'
value_location_payload_key: STATE.brightness
trigger:
match_list: '["Match: devices", "Match: tele", "Match: SENSOR", "Match: stat"]'
queueMessage: true
type: shimDimmer

Posted on
Mon Jan 18, 2021 11:14 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

The images were attached, I just can't read them well enough to see the actual text.

You can't guess at the payload. I need to see the actual payload for that topic, either from the MQTT Connector log or from something like MQTT Explorer.

Also, the Trigger definition doesn't match the topic you specified.

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

Posted on
Mon Jan 18, 2021 11:45 am
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

Using MQTT Explorer, if you click on an actual payload line in the left column, it'll show the complete payload on the right, with an icon above to copy it to your clipboard, Which you can then paste into a forum message reply.
Attachments
Screen Shot 2021-01-18 at 12.42.12 PM.png
Screen Shot 2021-01-18 at 12.42.12 PM.png (360.21 KiB) Viewed 3324 times

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

Posted on
Mon Jan 18, 2021 12:40 pm
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Hopefully this

Code: Select all
{"Time":"2021-01-18T19:36:59","Uptime":"0T01:45:10","UptimeSec":6310,"Heap":26,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":75,"MqttCount":2,"POWER":"ON","Dimmer":92,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"Wildone","BSSId":"4E:1B:86:C0:F2:53","Channel":8,"RSSI":100,"Signal":-48,"LinkCount":1,"Downtime":"0T00:00:04"}}

Posted on
Mon Jan 18, 2021 1:39 pm
FlyingDiver offline
User avatar
Posts: 7220
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Sonoff dimmer control with MQTT Shims

Ok, so the relevant part of that JSON payload is:

Code: Select all
"POWER":"ON","Dimmer":92,


Which means you need the Shim config to look like:
Screen Shot 2021-01-18 at 2.37.04 PM.png
Screen Shot 2021-01-18 at 2.37.04 PM.png (78.71 KiB) Viewed 3298 times


You also need to make sure the trigger is correct, as mentioned above.

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

Posted on
Mon Jan 18, 2021 2:00 pm
wasimpson offline
Posts: 20
Joined: Aug 26, 2019

Re: Sonoff dimmer control with MQTT Shims

Thanks
I will experiment with the trigger

Who is online

Users browsing this forum: No registered users and 15 guests