Closed randyarrasmith closed 4 years ago
Hi @randyarrasmith,
Thanks for the suggestion.
I have pretty limited understanding of ESPHome, so hard for me to feel confident I'm onto the right thing when I'm imagining how ESPHome and espMH could integrate. Could you perhaps go into more detail?
@sidoh Hi Chris. ESPHome is a user friendly interface to manage ESP8266/32 devices all in one place and using simple yaml configuration files with a built in API to home assistant. Easy to make changes and update devices OTA (over the air), etc. It is very neat. It is built on platformIO and so is your milight hub. I realize at a glance this may not be a perfect match since the hub is not a sensor but I am thinking something like yaml config for the different light groups, OTA for updates, etc. Defining the lights in ESPHome would make them automatically available in HA, then do something like "milight:" keyword to have it include the needed bridge component(s) then configuration of the bridge ip. I hope I am explaining this ok. It seems like an exciting idea (to me) and perhaps you can collaborate with Otto Winters (ESPHome).
https://github.com/esphome/esphome
https://esphome.io
what made me think of this is that I often ticker with esp(s) via ESPHome and forget I have this other one (the milight hub) sitting out there. I set it up like 2 years ago and I was recently demoing some things to a friend and one of the cool things is to change my front yard up-lights different colors, especially for holidays. So then I thought I should check if there is an update to the hub and of course there is. Man would it be cool if that showed in esphome with my other nodes and show an update was available. Then it occurred to me I could define the lights there also and not in HA directly. And then I could do an automation/transition from the esp also and not from HA. Who knows what else I am not even thinking of right now. :)
just an idea.... I appreciate the work you have done. And love the use of the hub in my system
Gotcha, that makes sense. I have used ESPHome before, but was wondering if there was some mode of operation with it I was unfamiliar, but sounds like not.
Integrating with it in this way would mean pulling the core milight stuff out of this project and adapting it to work with ESPHome's APIs, which would be a pretty huge undertaking. ESPHome is great for simple stuff, but I've found that I hit its limitations pretty quickly as what I'm trying to do becomes more complex. I'm therefore inclined to keep espMH its own thing.
Certainly supportive of someone else who wants to take this on, but this isn't something I see myself doing. Going to close, but feel free to keep the discussion going :)
Hi,
I have been using espMH for 4 years now, and am very happy with it!.
I have 20 (slightly modified) espMH devices in use: behind every wall switch, on that way I can control the lamps by the wallswitch, and via the Homeassistant (MQTT).
Also use ESPhome for a few other projects, and the easy management of those, and OTA also really appeals to me. I have therefore made an attempt at what Sidoh says: using the core from espMH in ESPHome. A first draft has been successful: see here: https://github.com/hencou/esphome_components Maybe it helps somebody who is searching for an example like this.
@hencou @sidoh Just want to say thank you for both of your work on this project. I was able to get @hencou's version up and running in ESPHome on an ESP32 D1 Mini and can confirm it's working well so far controlling lights from Home Assistant. Using ESPHome was much easier to get it up on an ESP32 than continuing the efforts started on #725.
@hencou - Let me know if there's anything else you'd like me to test. Adding remote receiving support would be nice too.
@hencou - Let me know if there's anything else you'd like me to test. Adding remote receiving support would be nice too. Receiving support should work, in the "esphome_components" version. When you compile ESP Home with loggin level "DEBUG" then you will see the received commands in the logging console.
Receiving support should work, in the "esphome_components" version. When you compile ESP Home with logging level "DEBUG" then you will see the received commands in the logging console. The state of the light in homeassistant will also update on the received commands.
Receiving support should work, in the "esphome_components" version.
Awesome, thanks. I didn't look that deep into that side yet. I'll play with it more, I'd like to eventually be able to receive commands from a separate remote and send them as events to Home Assistant (to control non Mihome lights). If the support is in there I should be able to do it with templates when I get to it. Thanks again.
Hi ALl,
is this still in process and or is there already running ESP home MH version out there? If so. Is there a way to move the correct config and paired bulbs into the ESP home MH ?
Yes, it has been running satisfactorily here for almost a year now. No need to re-pair the bulbs, just get the same DeviceIDs, GroupIDs and BulbType in your yaml config. See the yaml example: https://github.com/hencou/esphome_components/blob/main/example_milight.yaml
Yes, it has been running satisfactorily here for almost a year now. No need to re-pair the bulbs, just get the same DeviceIDs, GroupIDs and BulbType in your yaml config. See the yaml example: https://github.com/hencou/esphome_components/blob/main/example_milight.yaml
Nice, can this also used on a Wemos D1 for example and add all lights in the config? I have 34 lights now running on the Mlight Hub of Sidoh.
Yep. I have 2 bridges running ~20 lights on Esp32s with ESPHome.
The biggest disadvantage has been that you have to preplan the groups and add them to the config and reflash, but definitely worth the seamless integration with HA /Esphome dashboard. And with the new Text entity coming in HA, I'm sure there's going to be a way to replicate the Web UI from this repo.
Yep. I have 2 bridges running ~20 lights on Esp32s with ESPHome.
The biggest disadvantage has been that you have to preplan the groups and add them to the config and reflash, but definitely worth the seamless integration with HA /Esphome dashboard. And with the new Text entity coming in HA, I'm sure there's going to be a way to replicate the Web UI from this repo.
Nice,
Starting with a second Wemos D1 R2 module to create the hub. Get lots of issues. Wifi connection issues. Lost API issues etc... OTA uploads stuck on 8,15,67 or 90%
Have 8 ESP modules (wall switches) they work without any problem... Even far away from the router. Wemos D1 is even 1 meter from router and have issues
I use iobroker, it has a milight adaptor. As I am running 3 device ID's on esp8266, 3 instances of the adaptor are used. It looks like this: gestures up or down for brightness, click on/off (that's enough for the family ;-))
Yep. I have 2 bridges running ~20 lights on Esp32s with ESPHome. The biggest disadvantage has been that you have to preplan the groups and add them to the config and reflash, but definitely worth the seamless integration with HA /Esphome dashboard. And with the new Text entity coming in HA, I'm sure there's going to be a way to replicate the Web UI from this repo.
Nice,
Starting with a second Wemos D1 R2 module to create the hub. Get lots of issues. Wifi connection issues. Lost API issues etc... OTA uploads stuck on 8,15,67 or 90%
Have 8 ESP modules (wall switches) they work without any problem... Even far away from the router. Wemos D1 is even 1 meter from router and have issues
######################################################### # Below all fixed settings for Milight PCB ######################################################### substitutions: devicename: milight-hub-test friendly: Milight Test ip: 192.168.100.210 ######################################################### esphome: name: ${devicename} libraries: - milight=https://github.com/hencou/esphome-milight external_components: - source: github://hencou/esphome_components components: mi esp8266: board: d1_mini restore_from_flash: true api: encryption: key: !secret api_key time: - platform: homeassistant id: homeassistant_time preferences: flash_write_interval: 1min logger: ota: safe_mode: true password: !secret password wifi: ssid: !secret wifi_ssid password: !secret wifi_password reboot_timeout: 0s manual_ip: static_ip: ${ip} gateway: 192.168.100.1 subnet: 255.255.255.0 dns1: 192.168.100.1 ap: ssid: ${devicename} password: !secret password channel: 4 ######################################################### # Below specific for Milight settings ######################################################### mi: ######################################################### # Wifi ######################################################### listen_repeats: 3 ######################################################### # Setup ######################################################### ce_pin: D0 csn_pin: D8 reset_pin: 0 state_flush_interval: 5000 #0 ######################################################### # Radio ######################################################### packet_repeats: 50 #75 packet_repeats_per_loop: 10 #75 radio_interface_type: nrf24 rf24_power_level: MAX rf24_listen_channel: LOW rf24_channels: - LOW - MID - HIGH packet_repeat_throttle_threshold: 200 packet_repeat_throttle_sensitivity: 0 #40 packet_repeat_minimum: 3 enable_automatic_mode_switching: false on_command_received: - homeassistant.event: event: esphome.mi_command_received data: device_id: !lambda 'return format_hex(data.device_id);' group_id: !lambda 'return data.group_id;' remote_type: !lambda 'return data.remote_type.c_str();' command: !lambda 'return data.command.c_str();' ######################################################### # END ######################################################### light: ######################################################### # Sink ######################################################### - platform: mi id: sink1 name: "Sink 1 test" device_id: 0xAAA1 group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: sink2 name: "Sink 2 test" device_id: 0xAAA1 group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: sink3 name: "Sink 3 test" device_id: 0xAAA1 group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: sink_all name: "Sink all test" device_id: 0xAAA1 group_id: 0 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Kitchen ######################################################### - platform: mi id: seeling1 name: "Seeling 1 test" device_id: 0xAAA2 group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: seeling2 name: Seeling 2 test device_id: 0xAAA2 group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: seeling3 name: "Seeling 3 test" device_id: 0xAAA2 group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: seeling_all name: "Seeling all test" device_id: 0xAAA2 group_id: 0 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Hallway ######################################################### - platform: mi id: hallway_all name: "Hallway all test" device_id: 0xAAA3 group_id: 1 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Balcony ######################################################### - platform: mi id: balcony_all name: "Balcony all test" device_id: 0xAAA4 group_id: 1 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Bedroom all ######################################################### - platform: mi id: bedroom_all name: "Bedroom all test" device_id: 0xAABA group_id: 1 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Bedroom 1, 2, 3, 4, 5 and 6 ######################################################### - platform: mi id: bedroom1 name: "Bedroom 1 test" device_id: 0xAAAA group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bedroom2 name: "Bedroom 2 test" device_id: 0xAAAA group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bedroom3 name: "Bedroom 3 test" device_id: 0xAAAA group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bedroom4 name: "Bedroom 4 test" device_id: 0xAAAA group_id: 4 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bedroom5 name: "Bedroom 5 test" device_id: 0xAAAB group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bedroom6 name: "Bedroom 6 test" device_id: 0xAAAB group_id: 2 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Dressoir ######################################################### - platform: mi id: dressoir1 name: "Dressoir 1 test" device_id: 0xAAAF group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: dressoir2 name: "Dressoir 2 test" device_id: 0xAAAF group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: dressoir3 name: "Dressoir 3 test" device_id: 0xAAAF group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: dressoir_all name: "Dressoir all test" device_id: 0xAAAF group_id: 0 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Bathroom ######################################################### - platform: mi id: bathroom1 name: "Bathroom 1 test" device_id: 0xAAAD group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bathroom2 name: "Bathroom 2 test" device_id: 0xAAAD group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bathroom3 name: "Bathroom 3 test" device_id: 0xAAAD group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bathroom4 name: "Bathroom 4 test" device_id: 0xAAAD group_id: 4 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: bathroom_all name: "Bathroom all test" device_id: 0xAAAD group_id: 0 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Livingroom ######################################################### - platform: mi id: livingroom1 name: "Wall R test" device_id: 0xAAAC group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom2 name: "Wall L test" device_id: 0xAAAC group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom3 name: "Window R test" device_id: 0xAAAC group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom4 name: "Windows L test" device_id: 0xAAAC group_id: 4 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom1_all name: "Livingroom all test" device_id: 0xAAAC group_id: 0 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom5 name: "Wall LR test" device_id: 0xAABB group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: livingroom6 name: "Window LR test" device_id: 0xAABB group_id: 2 remote_type: rgb_cct default_transition_length: 0s ######################################################### # Toilet ######################################################### - platform: mi id: toilet1 name: "Toilet 1 test" device_id: 0xAAAE group_id: 1 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: toilet2 name: "Toilet 2 test" device_id: 0xAAAE group_id: 2 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: toilet3 name: "Toilet 3 test" device_id: 0xAAAE group_id: 3 remote_type: rgb_cct default_transition_length: 0s - platform: mi id: toilet_all name: "Toilet all test" device_id: 0xAAAE group_id: 0 remote_type: rgb_cct default_transition_length: 0s
Strange, what happens when you try with a few light devices configured in yaml? Maybe the Wemos D1 devices are less powerfull then ESP32s. I am also using Wemos D1 modules, with a max of 5 devices (never tried more) and that's working stable all the times.
Strange, what happens when you try with a few light devices configured in yaml? Maybe the Wemos D1 devices are less powerfull then ESP32s. I am also using Wemos D1 modules, with a max of 5 devices (never tried more) and that's working stable all the times.
I have installed all bulbs config on a new AZ Delivery D1 R32 board. ESP32 with 512kb. Every bulb is controllable. Only thing is that the bulbs not react correct as the original board with "Sidoh" Milight Hub image.
Groups of lights some not react at all, or not going off, etc. All kind of things. Played many times with all settings:
state_flush_interval: 5000
packet_repeats: 10
packet_repeat_minimum: 10
packet_repeats_per_loop: 25
packet_repeat_throttle_threshold: 500
packet_repeat_throttle_sensitivity: 0
radio_interface_type: nrf24
rf24_power_level: HIGH
rf24_listen_channel: LOW
rf24_channels:
- LOW
- MID
- HIGH
But its so unclear what best method will be to try improve those settings.
With "Sidoh" image I tried to copy all settings but this gives a very bad behavior on the new board with ESPhome.
With below settings I see for now much better performance
listen_repeats: 2
state_flush_interval: 1500 # 0 on production Wemos
#########################################################
# Radio section
#########################################################
packet_repeats: 50
packet_repeat_minimum: 25
packet_repeats_per_loop: 75
packet_repeat_throttle_threshold: 800
packet_repeat_throttle_sensitivity: 10
Can it be that ESP8266 is much lower in CPU speed then ESP32 and I have to increase the values more?
Moved over to ESPhome Milight and discuss there
It would be awesome if I could see my milight hub esp8266 in esphome. I suspect many of us using this are familiar with esphome and home assistant. In my opinion it would be a cool collaboration to be able to manage the hub and perhaps configure groups, control lights, etc using esphome.
just a thought :) love the work you have done!