Joshua
Junior Member
Posts: 75
|
Post by Joshua on Jan 28, 2018 16:51:11 GMT
Hello, How do I include the word Dimmer in the MQTT payload I’m working with a Armtronix Dimmer www.tindie.com/products/Armtronix/wifi-esp8266-based-single-triac-dimmer-board/ and after emailing the developer it appears that the mqtt payload needs to include the word Dimmer i.e. topic: /esp/dimmer01/sub payload: Dimmer:50 Here’s the regular command. The problem is the payload is only the numerical value {mqtt=">[mosquitto:/esp/dimmer01/sub:command:*:default]"} Any ideas?
|
|
|
Post by papa on Jan 28, 2018 20:16:08 GMT
Joshua, (I see you also posted on OpenHAB Community :-) I'm thinking that one way to address this is sendCommand in a Rule that relates to an item entry which sends something like your {mqtt=... Study the official OpenHAB docs starting here. In the rule, you might need to use variables to construct a string for sending like "Dimmer:50" In the above official docs, see this "An alternative way to command or update the state of an item is through the use of specially formatted strings" See also this thread, especially here, which is very good, but (at least for me) takes several readings to progress in understanding When you get this working, please document it here.Here's some interesting documentation, (including on reprogramming this device) Here's Armtronix's github code repository for this device.
|
|
|
Post by papa on Jan 29, 2018 1:49:31 GMT
Joshua, I am not able to test the following. However, based on this post by a skilled coder, something like the following might work as a test to point you in the right direction: The whole thread that includes the above post seems to assume an item named Dimmer. To avoid confusion, I'm changing the item's name to Triac. Combining what I've seen work elsewhere & your info, this might function as your item String Triac {mqtt=">[mosquitto:/esp/dimmer01/sub:command:*:default]"} Based on the link above, the rule to send what you need might be something like Based on the skilled coder's later post elsewhere & linked above, this might be a more reliable way to use sendCommand: Triac.sendCommand("Dimmer:" + new Integer(percent).toString)
|
|
|
Post by papa on Jan 29, 2018 2:24:59 GMT
Joshua, if something like the above item & rule suggestions work ... then for sitemap control of the Triac dimmer, you could look at this post & this post.
|
|
Joshua
Junior Member
Posts: 75
|
Post by Joshua on Feb 6, 2018 2:28:36 GMT
Thanks for the work. I've been out of pocket, but found a solution from the OpenHab forum. Thank you @rlkoshak at the OpenHab forum for you help with this post. Topics in the ESP web server configuration pubTopic: /esp/dimmer01/pub
subTopic: /esp/dimmer01/sub
OpenHab Items Switch ESPSwitch01 "ESP light1" (All,Test) {mqtt=">[mosquitto:/esp/dimmer01/sub:command:on:R14_ON],>[mosquitto:/esp/dimmer01/sub:command:off:R14_OFF]"}
Switch ESPSwitch02 "ESP light2" (All,Test) {mqtt=">[mosquitto:/esp/dimmer01/sub:command:on:R13_ON],>[mosquitto:/esp/dimmer01/sub:command:off:R13_OFF]"}
Dimmer ESPDimmer01 "ESP Dimmer" <slider> (All,Test) {mqtt=">[mosquitto:/esp/dimmer01/sub:command:*:Dimmer\\:${command}]"}
OpenHab rule. // rule to resolve dimmer max limitation of 99
rule "Set ESP Dimmer to 99 from 100"
when
Item ESPDimmer01 changed to 100
then
sendCommand(ESPDimmer01, 99)
end
Shopping list The ESP Dimmer from Armtronix in this posted has been phased out and replaced with this one. www.tindie.com/products/Armtronix/wifi-esp8266-based-single-triac-dimmer-board/Housing from Lowe's www.lowes.com/pd/Wiremold-NMW-1-Piece-White-Raceway-Electrical-Box/3152539Attachments:
|
|
|
Post by papa on Feb 6, 2018 15:07:53 GMT
Joshua, I'm glad you got your project working & I appreciate your reporting back with documentation.
As I said, rlkoshak is a skilled coder (& explainer). I suggest you include a link to where you found rlkoshak's help.
From the images, your project looks nicely & safely done. You have added another ESP8266 device to our documentation.
I look forward to your documenting future projects on this forum.
|
|
Joshua
Junior Member
Posts: 75
|
Post by Joshua on Feb 6, 2018 19:45:25 GMT
Changes made. Thanks for your guidance.
|
|