Node Red + Home Assistant -Master Class 5. How to control light dimming with Zigbee light and remote

Sdílet
Vložit
  • čas přidán 3. 11. 2020
  • In this video I'll show you how to use Home Assistant and Node Red to control dimming of a Zigbee controlled light from a Zigbee Multi remote from IKEA (Tradfri).
    You'll see how to toggle on and off, Dim up and Dim down in steps of 50 on a single click and how to dim up/down whilst holding until the button is released.
    We use a function node, switch node, Change state node, current state nodes and a trigger.
    Really want to show your appreciation? You can always "Buy me a beer"...
    www.buymeacoffee.com/homesight
    If you want the sequence to import, I've uploaded it here:
    homesight.tech/?portfolio=nod...

Komentáře • 77

  • @TimNorman1
    @TimNorman1 Před rokem

    This helped explain to me the process of getting the dimming to work. I have a Hue Phillips dimmer switch and was trying to figure out from pictures how others got it working. This helped bridge that gap for me. Thank you

  • @FloorVerschure
    @FloorVerschure Před 3 lety +20

    nice tutorial. Well explained. You can tell that you've put a lot of effort in the way you tend to explain everything.
    I did use the Ikea multi-button remote with a regular light group. This light group does not have a sensor with brightness to query, but there is another way:
    In HA light objects have their attributes stored in: msg.data.attributes You can find the parameter brightness there. Therefor I can simply remove the additional brightness node and replace "var brightness = msg.payload" with "msg.data.attributes.brightness = msg.payload" in the function nodes. as such I can use it with any light or light group in HA (Which has dimming support). Maybe this helps others who do not have the same setup and make the flow a bit more universal.

    • @HomeSight
      @HomeSight  Před 3 lety +1

      Good stuff! Thanks for the tip!

    • @d_sellers1
      @d_sellers1 Před 3 lety +8

      Your comment is what helped me get this function working. I, too, was having issues with getting the brightness value in/out of the function since I do not have sensor values.
      However, I believe there is a typo in your comment. It should read as: ...replace "var brightness = msg.payload" with "var brightness = msg.data.attributes.brightness" in the function nodes.

    • @ryklebaron
      @ryklebaron Před 3 lety

      thanks Floor!

    • @1997wert
      @1997wert Před rokem

      Thank You !! Helped me a Lot!👍

  • @jenswymeersch9653
    @jenswymeersch9653 Před 3 lety +1

    Great tutorial. Looking forward on additional ones regarding node red.

    • @HomeSight
      @HomeSight  Před 3 lety

      Glad you enjoyed it!

    • @jenswymeersch9653
      @jenswymeersch9653 Před 3 lety +1

      @@HomeSight I read you were thinking of an add-on to these master classes. I believe the most useful is a session specific on the function node and use of JSON/JS for Home Assistant.

  • @sojusreerankan8627
    @sojusreerankan8627 Před 3 lety +1

    Thanks for the detailed explanation learned few things from your tutorial videos, expecting more videos about Home automation with HA & Node RED integration...

  • @drreality1
    @drreality1 Před 3 lety +1

    Such a powerful and easy to follow tutorial 👍
    I actually have the automation with Ike's buttons, however instead of trigger nice I used delay node sending a single message each time and ignoring messages in between.
    Yours look much easier to debug
    Amazing work

    • @HomeSight
      @HomeSight  Před 3 lety +1

      Thank you, I remember looking for flows to import when I first started out, and imported some that were massively over complicated. I aim to keep it simple!

  • @alejandrolazaroZS09011386

    Que buen tutorial me ayudaste mucho !

  • @rrrrrrrr290
    @rrrrrrrr290 Před 3 lety +1

    you light up my life

  • @RogerStocker
    @RogerStocker Před 3 lety +2

    Hi Simon
    You are a good teacher and you do amazing nice things with Node-Red. I realized in one of the videos that there have been a lot of Shelly messages in the debug window. So I'm looking forward to see how you manage this pieces within HA. by intergating the Shelly entities or by switching to MQTT and using this "new" feature in the Shelly settings.

    • @HomeSight
      @HomeSight  Před 3 lety

      Thank you. Yes I use quite a few Shelly devices, I’m a big fan of their devices. There will certainly be some videos on using Shellies with HA!

  • @didactics
    @didactics Před 3 lety

    Dude, you saved me. Awesome job

  • @jproveta
    @jproveta Před 3 lety

    Very good, thanks.

  • @iSpaceCab
    @iSpaceCab Před 3 lety

    Hi there. Loving these tutorials, (slowly) learning a lot.
    I'm using the same Ikea Multi switch + Tp-link bulbs, I can get on off to work & it will dim up and down but not in steps, they go to max & min. I've been over and over it making sure I have everything as it should be according to the tutorial but no joy. Any pointers would be much appreciated. Cheers.

  • @v2gagao
    @v2gagao Před 3 lety +2

    NICE TUTORIAL, I would like to know how to use the side buttons (left and right) of the same IKEA switch to change colors randomly of the bulb.. please share some details around it.

    • @HomeSight
      @HomeSight  Před 3 lety +1

      Hi, I don’t have any colour changing bulbs, but I do have some Shelly RGBW2 and a flow which allows random colour selection, so I can do something with that! I’ll get on it! Thanks for watching.

  • @tpenick
    @tpenick Před 2 lety +1

    Great videos, they've really helped me a lot in my setup!
    One question though, is there a reason to check the light state first and then use the "turn_off" action if on and vice versa, as opposed to just using the "toggle" function? Does it help with efficiency?

  • @philou1516
    @philou1516 Před 2 lety

    Very nice tutorial, thx ! In the case I have a simple switch with only one hold action (and not one up hold and one down hold I mean), is there a way to switch between increase/decrease each time I release the button, please?

  • @robmiller3246
    @robmiller3246 Před rokem

    Love Your videos, I have learned a lot from them. Did the Ikea button work right of the box? I have a aqara mini button and am having an issue getting it to work with this automation

  • @ryklebaron
    @ryklebaron Před 3 lety +2

    This is what i did in my function node:
    var brightness = msg.data.attributes.brightness;
    brightness = parseInt(brightness);
    var dimmSize = 30; //ONLY CHANGE THIS VALUE IF YOU WANT A DIFFERENT DIMM SPEED
    var maxBrightness = 255;
    if (brightness

  • @dougle03
    @dougle03 Před 3 lety +2

    Would be great to see best methods to use sub flows to simplify this for reuse?

    • @HomeSight
      @HomeSight  Před 3 lety +1

      Sure, I’ll add it to the list!

  • @RandomGuy-lm8wh
    @RandomGuy-lm8wh Před 3 lety

    First of all, thank you for the great video`s you made. There are absolute the best on CZcams!
    The only thing I don't get right in this video is that I can't see or find any brightness entity on my lights.
    I want to increase the brightness of one specific lamp when my Nvidia Shield is paused during the night. I got everything working, except for the brightness part.
    So how can I get this to work, or how do I get the Brightness entity of (in this case) my light.kitchen entity?

    • @HomeSight
      @HomeSight  Před 3 lety

      Hi, that’s very kind of you to say! I don’t like having to split down JSON in my node red flows unless I can help it, so I strip it out and set it as a sensor in config.yaml. Here’s an example for you:
      - platform: "mqtt"
      name: "Bedroom 1 Brightness"
      state_topic: "zigbee2mqtt/bedroom1"
      availability_topic: "zigbee2mqtt/bridge/state"
      icon: "mdi:brightness-5"
      value_template: "{{ value_json.brightness }}”

  • @jj123456789000
    @jj123456789000 Před 3 lety +1

    Hey Simon! I used you tutorial and it work very well! I "pimp" a little the flow, so all the variables are define at the begining and also all the entities (you can put multiples light). I also add a random color changing (but my light are tuya, so the rgb stting dissapear for no reason). Also when you hold and release the arrow it goes full warm or full cold. Do you want the flow (copy/paste from node red)?

    • @HomeSight
      @HomeSight  Před 3 lety

      Great stuff glad it worked for you!

  • @thebarry1232
    @thebarry1232 Před 3 lety

    hey. is there a recommendation to have a AND button. I would like to add if I where to press toggle and brightness up together to preform a action like toggle on with full brightness.

    • @HomeSight
      @HomeSight  Před 3 lety

      Yeah, kind of. I would use a wait node.

  • @RAC7012
    @RAC7012 Před rokem

    I don't understand how you set up the sensor.bedroom_1_brightness entity? When I add my Ikea bulb to Z2M I don't get an entity that returns the brightness vlaue.

  • @dave-j-k
    @dave-j-k Před 3 lety

    HI, great video and answered a lot of questions :) I'm using a Hue 4-button dimmer but have a group of 6 zigbee bulbs - all works fine apart from the long press up/dn which sometimes works but can crash the dimmer action somehow - it seems there is a big delay in updating all the bulbs?? I have read it could be something called zigbee command flooding?? and I should create a zigbee group which acts as one entity, trouble is I can't find how to do that in ZHA - any ideas??

    • @HomeSight
      @HomeSight  Před 3 lety +1

      Hi and thanks! I've not seen the issue with crashing or delays... i haven't found ZHA to be the most useful in terms of logging etc, I primarily use zigbee2mqtt, which does give some pretty good logs so you can see what's going on... not sure that helps you though?!

  • @MrBobWareham
    @MrBobWareham Před 3 lety

    Hi can you use Node-Red with MQTT to make a small setup as I don't need Home Assistant I only have a few sockets, Sensors, Doors but would like to automate some things and not use EweLink so HA is overkill I use ESP8266, ESP32-CAM, AND SOME 433Mhz radio, thanks for sharing the course it is very good

    • @HomeSight
      @HomeSight  Před 3 lety

      Hi, yes you absolutely could. Although you would still need something to run your MQTT broker (Probably Mosquitto). Are you familiar with docker at all? Because that could be a good solution running a docker image of mosquitto is fairly straight forward (dependant on level of course)

  • @lassedomar2782
    @lassedomar2782 Před rokem

    Hi
    I would really like to use your flow, but your webpage seems to be down. Could you share it otherwse?

  • @hugovalderrama9768
    @hugovalderrama9768 Před 2 lety

    Hi Simon, how can I get the brightness from a tuya LED strips. I don’t have any entity with the brightness value ???

    • @HomeSight
      @HomeSight  Před 2 lety

      It’s not always available… are you sure it’s a supported feature?

  • @johnm4962
    @johnm4962 Před 3 lety

    Great video. Where are you located

    • @HomeSight
      @HomeSight  Před 3 lety

      Thanks John, I’m in the South West of England. How about you?

  • @thebatu89
    @thebatu89 Před 2 lety

    Excellent tutorial! Since i only have the aqara button (1x,2x,3x,4x clicks, hold and release). Is there a way to include both dimming up & down for the same hold action?

    • @HomeSight
      @HomeSight  Před 2 lety +1

      I guess it’s possible… just working it through in my head, I think I would check to see the current brightness then go down an “up” route or a “down” route, with down of its greater than 50%. I’d have a node either increasing or decreasing the brightness by 5% in a little loop with a current stater node which would check if an input Boolean is true. On the release of the hold you’d set the input Boolean to true, then kick off a delay of 5s to set it to false again so it’s ready for the next fade. Does that make any sense?

    • @thebatu89
      @thebatu89 Před 2 lety

      @@HomeSight hi yes, I can see that but I'm not sure yet how to add them in a function node since I'm still a beginner.
      I also just figured out why reset node wasn't working which keeps the trigger action keep increasing the brightness. Seems like z2m occasionally doesn't pickup the release action from my aqara button. Have you add similar issues with aqara if you have one?

    • @HomeSight
      @HomeSight  Před 2 lety

      I have various Aqara devices including the mini button you’re talking about. I’ve never noticed a missed release, but don’t actively use that function on a day-to-day.

    • @thebatu89
      @thebatu89 Před 2 lety

      @@HomeSight Is there a node that I can use to limit the payload sent to increase brightness if z2m didn't receive the 'release' action? Also do you mind sharing your own flow of checking the current brightness if less or more than >50% with the input boolean check?

  • @KG-lr2qw
    @KG-lr2qw Před 3 lety +2

    How do you get/set the bulb color temp? Is there going to be a Master Class 6?

    • @HomeSight
      @HomeSight  Před 3 lety

      Hi K G, yes there will be a Master Class 6. Still not quite sure what to do it on yet, I was wondering about showing how to do home occupancy.

    • @HomeSight
      @HomeSight  Před 3 lety

      Sorry, I missed your other question. You need to see what your bulb supports, as there is multiple ways that colour temp can be used a common way is as below using "color_temp" . Other ways can be "white_value", "color_name" or "hs_color".
      {
      "entity_id": "light.YourEntity",
      "brightness": 50,
      "color_temp": 50
      }
      Hope this helps!

    • @KG-lr2qw
      @KG-lr2qw Před 3 lety

      @@HomeSight How about sensors connected to arduino?

    • @KG-lr2qw
      @KG-lr2qw Před 3 lety +1

      @@HomeSight I was trying to get the yaml config, finally worked it out about using value_template: "{{ value_json.color_temp }}"

    • @HomeSight
      @HomeSight  Před 3 lety

      Hi, I don’t actually have any sensors connected to Arduino so not entirely sure...

  • @robertdriver6493
    @robertdriver6493 Před 3 lety +1

    I've been trying to use what I learned here. I am trying to control a dimmable light with a single modbus register. I made a sensor that reads the modbus register. I got the off and on working ok but when I follow your example I get an error at the call service light on. Call-service API error. Error Message: extra keys not allowed @ data['entity']
    Any ideas?

    • @robertdriver6493
      @robertdriver6493 Před 3 lety +1

      I got it working. I had to leave out the entity id in the first line.

    • @HomeSight
      @HomeSight  Před 3 lety

      Hi Robert, that’s great. Nice one!

  • @thomasgjrtzchristensen989

    Hi
    Love your Vids.
    I am using a Gledopto GL-007-P and it does not have any sensors like you refer to in the video.
    i can send mqtt commands to it but i can not read the current state.
    Do you know if there is any way to add it to a config file to give it a sensor i can use in node red

    • @HomeSight
      @HomeSight  Před 2 lety

      Hi, are you using zigbee2mqtt?

    • @thomasgjrtzchristensen989
      @thomasgjrtzchristensen989 Před 2 lety

      @@HomeSight yep :-) wanted to see if it was better than ZHA, but i am not sure if i like it yet

    • @HomeSight
      @HomeSight  Před 2 lety

      You can request the state in node red using: “zigbee2mqtt/FRIENDLY_NAME/get” for that type of light apparently

    • @thomasgjrtzchristensen989
      @thomasgjrtzchristensen989 Před 2 lety

      @@HomeSight sure i can. But it is not working :-( I can send commands but I dont get any answers when I request states. I have tried on all 4 gl-007-p's. Ahh well maybe I need to ask in the Z2M forum.
      Thanks :-)

    • @thomasgjrtzchristensen989
      @thomasgjrtzchristensen989 Před 2 lety

      No disrespect. Just dont want to waste you time ;-)

  • @Tntdruid
    @Tntdruid Před 2 lety +1

    Is this the last episode?

    • @HomeSight
      @HomeSight  Před 2 lety +1

      Yes, so far. I might extend it yet though!

  • @kalatos
    @kalatos Před 3 lety

    Hi there. I am stacked on the 4:25 minute when I am trying to get the brightness of the IKEA device. In my case the device is: IKEA ICPSHC24-30EU-IL-1 (www.zigbee2mqtt.io/devices/ICPSHC24-30EU-IL-1.html#ikea-icpshc24-30eu-il-1) I am able to control the device right from entity light.name_of_entity both toggle and brightness. I am not able to add sensor.entity_name_brightness because sensor type for this entity does not exist. Could you please advise?

    • @HomeSight
      @HomeSight  Před 3 lety

      Can you please copy and paste your yaml configuration?

    • @Bl4cksus
      @Bl4cksus Před 2 lety

      Having the same issue, I'm using Z2M + Mosquito, auto detection so no YAML....I can control the brightness in HA and Z2M fine, but it's an attribute, not a sensor...Did you ever find a good way to solve this?

    • @MangustaMG20
      @MangustaMG20 Před 2 lety

      @@HomeSight Actually, been stuck on this exact topic now for a day and its driving me potty. I just cant figure out how to configure the yaml file to read brightness - it just reads 'Unavailable' all the time, but I know I can through direct mqtt messaging.
      Yaml file contents here:
      #binary_sensor:
      sensor:
      #Ikea Remotes (Lounge,Kitchen)
      #Dimmer Switch (Lounge) - action, Battery, Signal
      - platform: "mqtt"
      name: "Lounge Dimmer Switch Action"
      state_topic: "zigbee2mqtt/Lounge Dimmer Switch"
      availability_topic: "zigbee2mqtt/bridge/state"
      icon: "mdi:gesture-double-tap"
      value_template: "{{ value_json.action }}"
      #Dimmer Switch (Kitchen) - action, Battery, Signal
      - platform: "mqtt"
      name: "Kitchen Dimmer Switch Action"
      state_topic: "zigbee2mqtt/Kitchen Dimmer Switch"
      availability_topic: "zigbee2mqtt/bridge/state"
      icon: "mdi:gesture-double-tap"
      value_template: "{{ value_json.action }}"
      #Light Bulb (Signal, Brightness)
      - platform: "mqtt"
      name: "Settee Overhead Light Brightness"
      state_topic: "zigbee2mqtt/Settee Overhead Light/get"
      availability_topic: "zigbee2mqtt/bridge/state"
      icon: "mdi:signal"
      unit_of_measurement: "lqi"
      value_template: "{{ value_json.brightness }}"
      #Sockets
      light:
      #Ikea Light Bulb
      - platform: "mqtt"
      name: "Settee Overhead Light"
      state_topic: "zigbee2mqtt/Settee Overhead Light"
      availability_topic: "zigbee2mqtt/bridge/state"
      brightness: true
      schema: "json"
      command_topic: "zigbee2mqtt/Settee Overhead Light/set"
      brightness_scale: 254
      switch:
      #Sockets (Lounge, Kitchen)
      - platform: "mqtt"
      name: "Lounge Light Socket Switch"
      state_topic: "zigbee2mqtt/Lounge Light Socket"
      availability_topic: "zigbee2mqtt/bridge/state"
      payload_off: "OFF"
      payload_on: "ON"
      value_template: "{{ value_json.state }}"
      command_topic: "zigbee2mqtt/Lounge Light Socket/set"
      - platform: "mqtt"
      name: "Kitchen Light Socket Switch"
      state_topic: "zigbee2mqtt/Kitchen Light Socket"
      availability_topic: "zigbee2mqtt/bridge/state"
      payload_off: "OFF"
      payload_on: "ON"
      value_template: "{{ value_json.state }}"
      command_topic: "zigbee2mqtt/Kitchen Light Socket/set"

    • @michaelyounge5743
      @michaelyounge5743 Před rokem

      @@HomeSight Hi love you videos , i too am struggling to obtain the brightness for the Multi Remote. Is there a solution. I am looking to use the remote to dim up or down ikea light .