Announcement

Collapse
No announcement yet.

Under kitchen cabinet LED lamps with mcsMQTT control

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

  • Michael McSharry
    replied
    https://github.com/xoseperez/espurna/wiki/MQTT

    As an example, a board with one relay will publish the relay status when it changes to:

    {root topic}/relay/0

    And will listen to commands to modify the relay status at:

    {root topic}/relay/0/set

    Leave a comment:


  • Pete
    replied
    On a lark last night decided to install the mcsTasmota firmware via OTA (minimal then regular bin) over the SonoffTasmota firmware. Bricked the Sonoff SV. It disconnected from the AP. Removed it and went to JTAGing it.

    I utilize Espeasy to write the bin file to the Sonoff SV via one easy line. Except that when I wrote the mcsTasmota file to the Sonoff SV it would not connect to the AP.

    1 - esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 blank1Mb.bin
    2 - esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 mcsTasmota.bin

    Wrote the current release of mcsTasmota to it and it still would not connect to the AP. I was going to then utilize Arduino IDE which I have done in the past. Rather trying another Sonoff firmware which worked the first time. I cannot figure out the MQTT messaging on it though. The commands are different.

    The firmware Espurna 1.13.1. I see the mosquitto commands and have associated the device with mcsMQTT but can not figure how to send mosquitto commands to it. The firmware forces you to create a web admin user / password configuration.

    Click image for larger version  Name:	espurna1.jpg Views:	1 Size:	61.7 KB ID:	1243473

    Here is an on and off via the relay button on the web interface of the new firmware.

    [563107] [WEBSOCKET] Requested action: relay
    [563110] [RELAY] #0 scheduled OFF in 0 ms
    [563112] [RELAY] #0 set to OFF
    [563116] [MQTT] Sending KitchenLEDs => 0 (PID 255)
    [563126] [MQTT] Publish ACK for PID 255
    [563198] [MQTT] Received KitchenLEDs => 0
    [563202] [RELAY] Matched group topic for relayID 0
    [563217] [MQTT] Sending KitchenLEDs/data => {"relay/0":"0","time":"2018-08-25 12:39:21","mac":"DC
    [563259] [MQTT] Publish ACK for PID 256
    [564118] [RELAY] Saving mask: 0
    [564300] [WEBSOCKET] Requested action: relay
    [564302] [RELAY] #0 scheduled ON in 0 ms
    [564308] [RELAY] #0 set to ON
    [564311] [MQTT] Sending KitchenLEDs => 1 (PID 257)
    [564323] [MQTT] Publish ACK for PID 257
    [564352] [MQTT] Received KitchenLEDs => 1
    [564355] [RELAY] Matched group topic for relayID 0
    [564412] [MQTT] Sending KitchenLEDs/data => {"relay/0":"1","time":"2018-08-25 12:39:22","mac":"DC:
    [564429] [MQTT] Publish ACK for PID 258
    [565314] [RELAY] Saving mask: 1

    What is interesting about this firmware is that it lets you configure a static IP, telnet. It is customized for the SonOff SV.

    Instead of using cmnd it uses set in Mosquitto.

    I think the command then would be something like this which I have tried but thinking I do not have it right yet.

    KitchenLEDs/set/data/relay/0
    Last edited by Pete; August 25, 2018, 01:01 PM.

    Leave a comment:


  • Pete
    replied
    Thank you Michael.

    This is what I see when I click on the HS3 button in the debug logs. The graphic doesn't change from on to off or off to on.

    8/24/2018 9:50:11 AM 2615928 | SetIOMulti 2310, oCAPI.ControlType=Button
    8/24/2018 9:50:11 AM 2615982 | ActoOnMessageFor Trigger Topic KitchenLEDs/cmnd/POWER1,Payload=OFF
    8/24/2018 9:50:11 AM 2615992 | ActoOnMessageFor Trigger Topic stat/KitchenLEDs/RESULT,Payload={"POWER1":"OFF"}
    8/24/2018 9:50:11 AM 2616000 | ActoOnMessageFor Trigger Topic stat/KitchenLEDs/POWER1,Payload=OFF
    8/24/2018 9:50:13 AM 2618038 | SetIOMulti 2310, oCAPI.ControlType=Button
    8/24/2018 9:50:13 AM 2618095 | ActoOnMessageFor Trigger Topic KitchenLEDs/cmnd/POWER1,Payload=ON
    8/24/2018 9:50:13 AM 2618104 | ActoOnMessageFor Trigger Topic stat/KitchenLEDs/RESULT,Payload={"POWER1":"ON"}
    8/24/2018 9:50:13 AM 2618114 | ActoOnMessageFor Trigger Topic stat/KitchenLEDs/POWER1,Payload=ON
    teReceiveDict , PluginDevice=False

    This is what I see when I toggle the power via the Tasmota web interface. The graphic changes fine from off to on or on to off.

    8/24/2018 9:52:34 AM 2758740 | ActoOnMessageFor Trigger Topic KitchenLEDs/RESULT,Payload={"POWER1":"OFF"}
    8/24/2018 9:52:34 AM 2758781 | Update Accepted 2310 to OFF StatusType=1
    8/24/2018 9:52:34 AM 2758792 | Updating Device from 1 PayloadNumeric=False
    8/24/2018 9:52:34 AM 2758806 | ActoOnMessageFor Trigger Topic KitchenLEDs/POWER1,Payload=OFF
    8/24/2018 9:52:35 AM 2760242 | ActoOnMessageFor Trigger Topic KitchenLEDs/RESULT,Payload={"POWER1":"ON"}
    8/24/2018 9:52:35 AM 2760242 | Update Accepted 2310 to ON StatusType=1
    8/24/2018 9:52:35 AM 2760247 | Updating Device from 0 PayloadNumeric=False
    8/24/2018 9:52:35 AM 2760256 | ActoOnMessageFor Trigger Topic KitchenLEDs/POWER1,Payload=ON
    False

    The payload here changes when I use the Tasmota gui to toggle the power.

    When I click on the button in the HS3 GUI it toggles the power but doesn't change the payload.

    Click image for larger version  Name:	ppayload.jpg Views:	1 Size:	23.0 KB ID:	1243210Here is the HS3 log when I click on the button in the HS3 GUI.

    Aug-24 5:06:06 PM Device Control Device: KitchenLEDs POWER1 to OFF (0) by/from: CAPI Control Handler
    Aug-24 5:06:09 PM Device Control Device: KitchenLEDs POWER1 to ON (1) by/from: CAPI Control Handler
    Last edited by Pete; August 24, 2018, 05:10 PM.

    Leave a comment:


  • Michael McSharry
    replied
    The HS graphic is controlled by the subscribe topic of the device. Topic KitchenLEDs/POWER1 apparently is not returned when the Sonoff receives KitchenLEDs/cmnd/POWER1 topic. Look at the MQTT traffic associated with the HS button toggle.

    Leave a comment:


  • Pete
    replied
    Michael McSharry

    Configured the ON and OFF mcsMQTT HS3 variable.

    When I toggle the switch from the Tasmota web interface the HS3 light variable graphic changes fine.

    When I toggle the switch from the on and off button in HS3 the LED light goes on and off but the HS3 variable graphic never changes.

    What is it that I am doing wrong here?

    Click image for larger version  Name:	mmqtt-1.jpg Views:	1 Size:	12.7 KB ID:	1243161

    Click image for larger version  Name:	mmqtt-2.jpg Views:	1 Size:	83.6 KB ID:	1243162

    Click image for larger version  Name:	mmqtt-3.jpg Views:	1 Size:	19.9 KB ID:	1243163

    Leave a comment:


  • Pete
    replied
    Went to the big box hardware store to look at the switches. They only had Leviton switches. Depth was 1" on a double paddle switch. It was 1.5" on a triple paddle switch.

    No problems fitting the double paddle switch with the LED 1 AMP power supply in the 4X4 metal box with the single duplex mudplate on it. Mounted the combo Sonoff SV and dimmer box with velco. Tinned the wires for easy terminal installation. Leaving the power on the LED lamps can be automated using the Sonoff SV / McsMQTT. Switch powers on and off at the 120VAC side of the LED transformer. The dim level stays where every it is adjusted to.

    Next piece of this endeavor is to mount the LED lamps in a diffuser. Here may use barrel connectors. In the future may pass the 12VDC LED lamp wires down to the basement and up to the other counters in the kitchen. Thinking the 1AMP PS should work. This way it is one switch and one dimmer for all of the over the counter LED lighting.

    Click image for larger version  Name:	LED-Dim-Power.jpg Views:	1 Size:	45.0 KB ID:	1243044

    Leave a comment:


  • Pete
    replied
    Pete

    how can you tell what version is on the Sonoff looking at the information on the web gui?

    Here looking at the date of build and it just shows 6.1.1

    Program Version 6.1.1
    Build Date & Time 2018-07-31T17:59:09

    On the Tasmota release page it shows.

    Update 20180731

    Replaced sonoff.bin with a slightly smaller version (disabled sensor LM75AD) making wifi connection more stable due to different compiler optimization.
    Replaced sonoff-minimal with a version not forcing to default settings leading to unability to upload final image.

    Changelog

    Version 6.1.1 20180714

    Revert wifi changes (#3177)
    Revert some sonoff-minimal removals causing failure of wifi connection (#3177)

    Where can I see the 6.1.1.7 piece in the Web GUI?

    Found the source here and see:

    6.1.1.8 - Fixes and Additions

    6.1.1.8
    * Fix MQTT reconnection detection when using TasmotaMqtt library (#3558)
    * Add build time setting of ButtonTopic and SwitchTopic (#3414)
    * Add display features and dynamic buffering

    arendst committed 2 hours ago


    Are you uploading development builds using Arduino IDE?



    Last edited by Pete; August 23, 2018, 06:53 AM.

    Leave a comment:


  • petez69
    replied
    Pete

    6.1.1.7 works, I had a hell of a time with the earlier 6.1.1 versions....

    Leave a comment:


  • Pete
    replied
    Noticed that I have to try three times to get to the mcsTasmota web gui before it comes up and only once with the Sonos SV Sonoff-Tasmota 6.1.1.

    Wondering if it is because the Sonoff SV isn't doing anything versus the Sonoff wifi basic module?

    Tonight configuring the Sonoff SV to talk to mcsMQTT for remote on and off of switch.

    Leave a comment:


  • Pete
    replied
    Another change.

    Current the LED Power supply inside of the 4X4 box is not switched such that the 12VDC output is always on.

    Putting a conventional 3 paddle switch in the light switch box will not work for this project.

    Found an EU style switch from Livolo 3 gang with a depth of less than 1" which would be ideal. The wires are connected to the side of the switch which which would make the switch fit nicely in the 4X4 box with the LED transformer.

    The 4X4 double metal box is only 1.5" deep (standard box here). Found that Livola has a 3 paddle Decora style switch which I ordered for $10 with free shipping.



    Got the diffusers yesterday.

    Might be a bit too tight with LED lamps that I am using so may replace these now with a light strip which is cheaper than the current LED lamps.

    Click image for larger version  Name:	LEDLamps.jpg Views:	1 Size:	64.6 KB ID:	1242705

    Just checked the size of the diffuser versus current testing led lamps. The 3-LED lamp base is too wide and too high.

    Reading a bit here see the quality / build of the under $20 LED strips are junk unless I go to a $50 LED light strip. IE: the original LED's that I am using are better quality (~$4 per 3 LED X 10 = $40 for what I am using).
    Attached Files
    Last edited by Pete; August 22, 2018, 07:31 PM.

    Leave a comment:


  • Pete
    replied
    petez69

    I loaded 6.1.1 tasmota and found the web interface to stall at times and unable to control the Sonoff Basic. A number of them wouldnt associate with the AP. I put 5.12 back on and they work fine....I can't be the only one seeing issues ?

    Here tinkering with the Sonoff SV. It came with Sonoff firmware 1.6.

    Checking it updated it to Sonoff firmware 1.8 - took a long time and repeated efforts in upgrade.

    It wasn't an issue with the WAP rather just related to firmware updating via China.

    It would keep getting to the registration piece then stall and I needed to do this some 4 times over an hour or two.

    I have read that Sonoff is delivering hardware now with firmware 2.X. Folks are mentioned something about a design change to the hardware.

    Documentation is scarce and figuring it out using a variety of sources.

    I wanted a 12VDC powered Sonoff device. I like that you can power it up and output via relay 12VDC.

    Wrote all zeros to firmware via Linux command line the wrote bin files.

    Then soldered on JTAG pins and updated the Sonoff SV to current version of mcsTasmota 5.9.13G.

    Played a bit with it and then updated it to Sonoff-Tasmota 6.1.1 by Theo Arends.

    I find the Sonoff-Tasmota 6.1.1 firmware web interface a bit faster than the mcsTasmota 5.9.13G.

    But currently not doing Mosquitto and only have the relay configured. No issues with WAP connectivity.

    Having issues with sunrise / sunset times on the device using the Tasmota timer features.

    PO'd at Amazon Prime today as I have not received my LED diffusers ordered last THU two day.

    Tracking delivery and it appears to be using UPS versus USPS and package has done a round trip across the country so far. It is promised today.
    Last edited by Pete; August 21, 2018, 08:38 AM.

    Leave a comment:


  • Pete
    replied
    Yeah last night a bit of a waste here soldering and removing pins from the dimmer control board broke it in half.

    Had a few spares dimmers so redid it.

    Sort of finished combo Sonoff SV and dimmer box and it is working fine now. Now wanting to fit a DS18B20 temperature sensor in the concocation.

    Click image for larger version  Name:	sonoffsvdone.jpg Views:	1 Size:	77.2 KB ID:	1242464
    @Bram,

    So the original purpose of said endeavor was the installation of LED lamps under the kitchen cabinet and using manual on and off and dimming control and to utilize a mini LED power supply inside of the electrical box. Bringing a new circuit to the electrical box was the most time consuming effort.

    Kitchen / automation / WAF do not mix well here.

    This was done first and I could have left the endeavor alone as the under the kitchen cabinet lamps are left on 24/7.

    The simple piece of infrasture was completed yesterday. There really wasn't a need to do this. Just keeping busy here.

    Concurrently and I know this is a waste of technology but it is more to get familiarized with a different SonOff device called the SonOff SV and turning on and off and dimming at a 12VDC voltage rather than a 120VAC voltage.

    My very first LED tinkering was outside with the garden lighting. It got a bit elaborate and I went to 12 zones of lighting connected to multiple MeanWell DIN mounted DC power supplies (went from 12VAC here to 12VDC. All 6 dual 12VDC DIN power supplies were turned on and off via one UPB powerline switch. Another exercise in the making here is to switch on and off the outdoor low voltage LED lighting per 12VDC zone using multiple 12VDC relays automated control rather than one AC switch for all of the DC LED power supplies. Except for the UPB switch I mounted all of the MeanWell power supplies on a DIN rail. Next will mount SonOff multiple relay device(s) on same DIN rail to make for a nice compact multiple zone LED lighting thing.



    Leave a comment:


  • petez69
    replied
    I loaded 6.1.1 tasmota and found the web interface to stall at times and unable to control the Sonoff Basic. A number of them wouldnt associate with the AP. I put 5.12 back on and they work fine....I cant be the only one seeing issues ?

    Pete

    Leave a comment:


  • AshaiRey
    replied
    Well Pete. This may be an excercise for you but i am baffled with the amount of technology you throw at it to do a simple task.

    Leave a comment:


  • Pete
    replied
    Yeah adjusted time, longitude and latitude but my sunrise and sunset times are way off with Sonoff-Tasmota 6.1.1 firmware.

    Click image for larger version  Name:	status7.jpg Views:	1 Size:	34.6 KB ID:	1242362

    Took apart one of those el cheap 12VDC dimmers to put in the small project box with the Sonoff SV. There is not much to the dimmer. Unsoldered terminals and connected wires. 12VDC dimmer circuit board is 1.5" X 1". Sonoff SV is 2.5" X 1.25". Pot will be mounted either on the side of the case or on the lid of the case.

    So in the little project box will be the SonOff SV plus dimmer combo off on switch.

    12VDC ==> [ Sonoff SV ==> 12VDC dimmer / on / off switch] ==> LED lamps.

    Click image for larger version  Name:	12VDCDimmer.jpg Views:	1 Size:	165.8 KB ID:	1242363

    Finished wiring up combo 12VDC Sonoff SV to 12VDC 12VDC dimmer/switch. It'll be a tight fit in the small project case.
    Left terminals are 12VDC from LED power supply and right terminals are 12VDC dimmable output.



    Click image for larger version  Name:	comboswitch.jpg Views:	1 Size:	143.4 KB ID:	1242398
    Last edited by Pete; August 20, 2018, 08:02 PM.

    Leave a comment:

Working...
X