Announcement

Collapse
No announcement yet.

Magic Home Plugin - Support for addressable RGB controller

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

  • Michael McSharry
    replied
    The default setup for mcsMQTT is to listen to everything that is routed through the broker. This is great when you want to setup a new widget to be part of HS, but if there is a lot of MQTT traffic that is not of interest then it is just a waste of CPU cycles. After you have your setup configured then change the General tab setting in Inbound Management to only listen to what you have associated to HS devices. You can always change it back later if you want to discover something else that was recently added to MQTT network.

    There is a section of the manual on Performance considerations and it contains some benchmarking that determined the main culprit for CPU use is when the HS object needs to be used. This means that if you associate many end points to HS devices then there is processing burden. Express mode was setup to help address this. Again look at the benchmarks. There is some loss of extended capability in Express mode but for most things it will do what you want. Express mode is selected on topic by topic basis so you can use normal mode for topics that need extended processing. There is also some configuration options on General tab, Inbound management as to which feature should be enabled in Express mode.

    At startup, mcsMQTT can enumerate all HS devices so any device is available for selection on Association tab to be mapped to MQTT topics. The default had been to always do it at startup. I have changed the default to only do it when requested. The only time you want to enumerate the devices is if you added a new one that you want to be used with MQTT. Look at the General tab, Outbound management, HS Device Discovery setting at the bottom to see how your mcsMQTT.ini has it setup.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Hi Micheal,

    I tired your plugin again.

    When the plugin does not run, the cpu time (% use over time is at 1.4-1.5%) for the hsconsole.exe process .

    but when i start your plugin , change the broker to my personal one, and let it run, the %cpu (devised by the time since the app is running) , is at 4.5-5%.

    Do you know what could cause this?
    Thanks

    Leave a comment:


  • Michael McSharry
    replied
    I moved the continued discussion of mcsMQTT integration of WLED to https://forums.homeseer.com/forum/li...6-wled-support.

    It should be clear that while the MagicHome hardware can support the WLED firmware, the MagicHome App does not so unless changes are made to the MagicHome plugin then the integration described here cannot be done with MagicHome plugin.

    It should also be pointed out that the stock MagicHome firmware does not run WLED so this hardware will need to be flashed with different firmware. There are many descriptions and videos on doing this flashing.

    Leave a comment:


  • Michael McSharry
    replied
    The plugin is doing it all now when is see a topic starting with wled/. What I have implemented is the online status device, on/off buttons, brightness slider, Color picker, Effect selector with all available effects which I think are 73. A slider for Effect speed and a slider for Effect intensity. There are a number of ofther end points that I set everything up, but did not create the HS device. These just need the "a" column checkbox checked and everything else happens automatically. Examples are nighttime, modes and about a dozen others that are reported on the /api topic. I did discover the /api topic does report the current effect so there is feedback to use fo sync the HS device. I will post it later today. It will be an update to mcsMQTT so the first step is to install mcsMQTT and then copy two files that contain the update.

    Leave a comment:


  • The Profit
    replied
    Originally posted by Michael McSharry View Post
    Now that I understand wled API what I will do is add it to mcsMQTT. Anytime a topic starting with wled is observed it will setup everything in HS just as outlined in the step by step procedure. I will use VSP for preset and other similar options to provide a preset type operation.
    Thank you very much! So just to make sure I understand, after you make the changes to the plugin, will the above steps still need to be done or will the plugin automatically perform those steps?


    Sent from my iPad using Tapatalk

    Leave a comment:


  • ocyberbum
    replied
    Originally posted by Michael McSharry View Post
    Now that I understand wled API what I will do is add it to mcsMQTT. Anytime a topic starting with wled is observed it will setup everything in HS just as outlined in the step by step procedure. I will use VSP for preset and other similar options to provide a preset type operation.
    Thank you Michael, Getting this working will be a milestone for me and HS but This will give me the ability to really customize my lights and the flexibility to create some wanted events, and adding this to my Magiclights and Tuya in HS4 should keep me busy

    Leave a comment:


  • Michael McSharry
    replied
    Now that I understand wled API what I will do is add it to mcsMQTT. Anytime a topic starting with wled is observed it will setup everything in HS just as outlined in the step by step procedure. I will use VSP for preset and other similar options to provide a preset type operation.

    Leave a comment:


  • Michael McSharry
    replied
    I don't understand why I am not having success with flashing ESP8266, but I did have it with ESP32. It really does not matter which is used for integration with HS as long as flashing is possible. I will look more later for the ESP8266, but for now I just want to document the integration with HS.

    1. Flash WLED. Last release is 8.5. I am actually using beta 2 of 9 that I compiled from source from github. I suggest just using the binary that was already compiled.
    2. Configure WLED for your network. The device will setup an AP on 192.168.4.1 using SSID starting with WLED. Search google for setup if not obvious. I skipped this step because I compiled my network credentials in the source build.
    2. Install mcsMQTT from HS Updater.
    3. Go to IP of ESP (e.g. 192.168.0.223 in my case) and select the Sync Interfaces button. Toward the bottom of the page will be the MQTT setup shown below. Two entries to be made. Enable MQTT checkbox and the IP address of the HS Server. mcsMQTT will be the broker running on the same IP, but port 1883 rather than the HS server on port 80.

    No change needed, but note the Device Topic. It will be showing up in mcsMQTT.

    Click image for larger version  Name:	WLED_MQTT.PNG Views:	0 Size:	21.0 KB ID:	1357701
    4. Restart ESP to start MQTT running on it.
    5. Access mcsMQTT from HS plugins menu item. On Association tab of mcMQTT the current state of WLED configuration will appear as shown below

    Click image for larger version  Name:	Capture.PNG Views:	0 Size:	68.5 KB ID:	1357702
    The topic wled/55b1f4/g is the brightness reported. wled/551f4/c is the color. You will not see the first line shown above because I sent that from another computer to change the brightness of the WLED.

    Working on brightness first select the "a" column checkbox to create a HS device for managing brightness. The "ref" column box will change to a pushbutton with the HS Device Reference and the "TOPIC" column for that row will show an additional text box for the command topic to be used to change the brightness. Fill in the same topic showing on the Sub: line, but leave off the "/g". This is the topic per the WLED API to use to control brightness. https://github.com/Aircoookie/WLED/wiki/MQTT

    Click image for larger version  Name:	Capture1.PNG Views:	0 Size:	8.9 KB ID:	1357703
    HS wil now have a number box setup to specify the brightness. In the current version of mcsMQTT a slider is available, but the version in the updater does not have it. We can change this later, but for now this will suffice.

    Next is the color that shows as #FFA000 in my case. Click on the "a" checkbox to create the HS device, In the new textbox in TOPIC column enter the same topic as Sub: line, but suffix "ol" as /col is the end point per WLED API to command color.

    Click image for larger version  Name:	Capture2.PNG Views:	0 Size:	9.2 KB ID:	1357704

    Since the payload looks like text to mcsMQTT it will setup a text box entry in HS device. This is not what we want, but want a color picker. Click on the Ref bottom of the row (1761 above) to bring up the popup to change it to RGB color picker. Note the Control Status UI row where this is done. The RGB radio is selected and now the HS device will show a color picker control on Device Management.

    Click image for larger version  Name:	Capture3.PNG Views:	0 Size:	18.4 KB ID:	1357705

    The next thing of interest is the effects selector. Apparently WLED does not report the status showing which effect is active. That is something that seems like an appropriate enhancement to be made. I probably could add it to the source, but should be something done by the author. Not needed, but positive feedback is always nice to have so HS remains in sync.

    To cover this we will make up a topic just as a placeholder to have a device to put the effects selection. Refresh mcsMQTT page to get a fresh page that will have an empty Edit/Add tab

    Click image for larger version  Name:	Capture5.PNG Views:	0 Size:	11.5 KB ID:	1357706
    In the Sub: text box enter the dummy topic. I used wled/55bf14/fx. mcsMQTT then creates a new device. In this case it is 1762. Effects are commanded per topic wled/55bf14/api per WLED API. The commands supported via this topic are disclosed at https://github.com/Aircoookie/WLED/w...TP-request-API. This means that the HS Device Publish Topic is set to wled/55bf14/api

    There are a few ways to go with using this newly created device. In the simplest case it will be for the LED Effect index for WLED which has a value between 0 and 79. The easiest setup is create a number box on HS device where one types the desired number. Another is to setup Value-Status pairs and then a list pulldown or set of buttons. While still on the edit/add tab of newly created device select the Control/Status UI to be number for the first case or List/Button for the second case. For right now let us use the number box. It can be changed later. When Button or List is selected then the row HS Device VSP List is populated with a text box to allow entry or value-status pairs.

    The WLED API indicates that the payload needs to be prefixed with a parameter. LED Effect Index uses "&FX". This means that the Publish Payload Template line on the Edit/Add tab for this device needs to have "&FX=" followed by $$VALUE: where $$VALUE: is the substitution variable for the HS Device value. The result of this is shown below.

    Click image for larger version

Name:	Capture6.PNG
Views:	187
Size:	83.5 KB
ID:	1357708

    I still need to proof this, but running out of time now. There are other options for configuration such as creating other devices that use the /api topic for speed (SX=), effect intensity (IX=), etc from the WLED API reference.

    Leave a comment:


  • The Profit
    replied
    Originally posted by Michael McSharry View Post
    I will give you the step by step on integrating WLED with mcsMQTT. mcsMQTT is able to provide the list selection for effect, on/off button, slider for brightness and color picker for color selection. What other aspects of WLED are you looking to have in HS?
    Wow! Very kind of you, and greatly appreciated! For now that would be more than enough. I saw that there was a way to setup Presets/shortcuts for favorite effects that I was thinking of using so I could just have HS select from a shorter list of frequently used effects. Not sure if that’s possible?

    Originally posted by Michael McSharry View Post
    I initially tried to flash the WLED version 9 beta onto a magichome board that was previously running Espurna. It did not bring up an WiFi AP so I flashed the released version 8 on a D1 Mini and same story of no AP setup by WLED. Tried clearing flash and reinstall and again no luck with WLED running in ESP8266. Looked at the serial console when booting and no feedback on the console. I will play with it some more such as with source or give ESP32 a try. This is a part of the process that should be easy with multiple WLED users and flashing is something I do often.
    The video that I watched was flashing a ESP8266, not the magic home board and it of course worked for the video...didn’t make it appear difficult but obviously from your experience, it’s not always easy.


    Sent from my iPad using Tapatalk

    Leave a comment:


  • Michael McSharry
    replied
    I will give you the step by step on integrating WLED with mcsMQTT. mcsMQTT is able to provide the list selection for effect, on/off button, slider for brightness and color picker for color selection. What other aspects of WLED are you looking to have in HS?

    I initially tried to flash the WLED version 9 beta onto a magichome board that was previously running Espurna. It did not bring up an WiFi AP so I flashed the released version 8 on a D1 Mini and same story of no AP setup by WLED. Tried clearing flash and reinstall and again no luck with WLED running in ESP8266. Looked at the serial console when booting and no feedback on the console. I will play with it some more such as with source or give ESP32 a try. This is a part of the process that should be easy with multiple WLED users and flashing is something I do often.

    Leave a comment:


  • The Profit
    replied
    Originally posted by Michael McSharry View Post
    The WS2811 should work much like the WS2812B without resolution to individual pixels,but groups of nine and 12 V for power which likely is preferred anyway. Just load Tasmota or other compatible firmware on some ESP8266 device and use the MQTT interface per the API of the firmware that was loaded. I suspect the stumbling block for the novice is flashing the ESP8266 as the interface with HS via MQTT already exists. I suspect what is being requested is a plugin that does not require flashing of the microcontroller.
    Hi Michael, I know very little, if anything when it comes to MQTT and boards like the ESP8266, however the stumbling block for me would be the HS integration. I watched a couple of videos on flashing the boards and it didn’t appear to be much of a learning curve. I just don’t have your expertise with MQTT and how to then integrate the boards with HS. If you know of a way to bridge that gap, that would be great. I watched a video where the guy flashed the board and then input the IP into (I assume) the plugin for Home Assistant and it created the devices for an addressable LED strip.

    I have looked briefly at your MQTT documentation, no doubt it is an amazing plugin, to a novice (only recently exposed to MQTT) like myself it is a little overwhelming. I don’t mean any offense, it could be I just need to spend more time with it. There will certainly be some new vocabulary to learn but from what I’ve learned, it can open up a bigger world for Home Automation.


    Sent from my iPad using Tapatalk

    Leave a comment:


  • fuzzysb
    replied
    Originally posted by ocyberbum View Post
    Out of curiosity would these also be controllable through homeseer? it uses the Smart Life app which looks similar to MagicLight

    https://www.amazon.com/Novostella-27...s%2C134&sr=8-4
    They are Tuya Lights. They won't work with this plugin. But there is a HS3 plugin available I think. However homeseer include a Tuya plugin free for HS4 which I am currently testing on my hs4 install and it works

    Leave a comment:


  • ocyberbum
    replied
    Out of curiosity would these also be controllable through homeseer? it uses the Smart Life app which looks similar to MagicLight

    https://www.amazon.com/Novostella-27...s%2C134&sr=8-4

    Leave a comment:


  • kriz83
    replied
    Discovery is the same as for normal ESPHome lights, so it should not be an issue to add it. It will be possible once i have the light component added, don't have exact dates yet though, working on the cover component now (for blinds/garage/...).

    You could try Michael's plugin, I've been using it for a long time.

    Leave a comment:


  • ocyberbum
    replied
    From what little i know, i was hoping to follow the video instructions below from DR Zzs video to setup a nodecmu then trigger some of the built in or custom effects through homeseer based on dates and times for addressable led lights around the house

    https://www.youtube.com/watch?v=tXvtxwK3jRk

    Leave a comment:

Working...
X