Trust ZYCT-202 setting up dimming via zigbee2mqtt

Hello community - I’m attempting to setup this Zigbee remote to brighten and dim my bulbs.

From what I’ve read here I’ll need the following to get this working:

• A input boolean
• A automation
• A script

I’m looking for some examples for the above setup - if any one could point me in the right direction for writing the automations, scripts and boolean using the MQTT state changes below I’d be grateful - this kind of scripting goes over my head. Perhaps the link above is almost correct for my switch?

I’ve read somewhere I may need to check what commands my bulb uses for brightness - where should I find the correct value?

MQTT state change commands
Examples are for Light 1:
On button = {‘action_group’: 145, ‘linkquality’: 18, ‘action’: ‘on’}
Off button = {‘action_group’: 145, ‘linkquality’: 36, ‘action’: ‘off’}
Bright = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘up-press’}
Dim = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘down-press’}
Release bright or dim = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘stop’}

WAF will be accomplished once I’ve got this working.

Hi,
Maybe you just need to wait for HA 0.106. They are introducing some new services to brighten/dim lights; brightness.increase resp. brightness.decrease
You can read more about this in the beta release notes.

Wow yes that looks great - thanks

Hi, you can check out ControllerX for this. It is a project I have been working on. You can also find a topic on the forum in here.

I believe you are the same that sent me an email, I currently not support this device, but the only thing I need to know is all the states/events that the controller can fire, so I can give as much functionality as possible. If those are the only states, you will be able then to:

  • Turn on/off the light
  • Change brightness when holding

I assume that “on” and “off” are only sent when clicking and not holding. If there was a holding event for on/off then I would be able to integrate the controller so it can change the color or the color temperature as well. And then I also assume that the brightness up/down also fires up when holding and it always sends the stop (no matter if you press or hold).

Let me know about all the events and I will integrate the controller asap.

Thanks,
Xavi M.

Evening Xavi - I found this post on git which lists the buttons on the Trust ZYCT-202. Is this helpful for mapping with Controller X.

It seem’s only the Brightness Up and Down buttons have the ‘stop’ action when holding.

Thanks again,

1 Like

This would be enough then. I will add the device and let you know to try. @tomplums

1 Like

I owe you a beer

Hi again,

I have added this device into the beta release v2.3.0b9. You can check the documentation for the device in here. You will need to install AppDaemon addon and HACS if you do not have it. Then you will find ControllerX in there.

The configuration for it to the apps.yaml for this device will be something like:

example_app:
  module: controllerx
  class: ZYCT202LightController
  controller: sensor.remote
  integration: z2m
  light: light.your_light_entity

You can check the documentation for ControllerX in here. I also added support for this controller to control media players.

Let me know if you have any questions.

1 Like

Great - thanks Xavi. I have setup and installed everything I will be able to test tomorrow as I’m away for the night.

The controller has a button which can select up to 5 devices and another button for Group. It uses ‘action_group’

Light 1 = ‘action_group’: 145
Light 2 = ‘action_group’: 146
Light 3 = ‘action_group’: 147
Light 4 = ‘action_group’: 148
Light 5 = ‘action_group’: 149
Group = ‘action_group’: 150

Is that something that could be added to the device for Controller X?

Hi @tomplums,

Do those buttons send any mqtt message or change the state of sensor.remote? If so what is the message?

With ControllerX you can control 1 light or a group of lights if you set a group of entities from Home Assistant. So instead of light.your_light_entity, it would be group.your_group_entity.

unless I am misunderstanding what’s needed here are the mqtt messages:

Examples are for Light 1:
On button = {‘action_group’: 145, ‘linkquality’: 18, ‘action’: ‘on’}
Off button = {‘action_group’: 145, ‘linkquality’: 36, ‘action’: ‘off’}
Bright = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘up-press’}
Dim = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘down-press’}
Release bright or dim = {‘action_group’: 145, ‘linkquality’: 31, ‘action’: ‘stop’}

Other lights give different action groups.
Light 2 = ‘action_group’: 146
Light 3 = ‘action_group’: 147
Light 4 = ‘action_group’: 148
Light 5 = ‘action_group’: 149
Group = ‘action_group’: 150

aah! Okay @tomplums

Sorry, I did not understand what you meant with action_group. ControllerX is designed to work with just one light or a group of lights. If you want to use the same controller for different lights, you will need to create different app instances and use constrain callbacks. However, I don’t think you will be able to use action_group. You can see an example of ControllerX using the same controller depending on an input_select in here.

If the controller sends an MQTT message when those buttons are pressed, there would be a way to do it through ControllerX, otherwise, it is not possible.

Another trick would be to use the “I” button to toggle the light and the “O” to send the action_group since the others do not send an MQTT message. This way then, you would need to map action_group as an input_select and then use something similar to the example I sent before.

Anyhow, let me know if you are interested in the later and I can help you out with the configuration.

@tomplums Did you successfully use this remote control to turn the light on and off?

Although Xavi very kindly offered help for the switch the features I needed weren’t quite right. I ended up using Node-red and it was amazingly simple and all features work.

I’ll post the flow I used shortly.

1 Like

I will be grateful if you describe it. I have been struggling with it for several days and I can’t make it work properly.

sorry for the delay.

Try this in node red and let me know if you need any help

[{"id":"aaeb84d7.0184e","type":"tab","label":"Trust 202 on/off","disabled":false,"info":""},{"id":"19e86797.74df68","type":"switch","z":"aaeb84d7.0184e","name":"On, off, up, down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":790,"y":300,"wires":[["b6faf5d5.7c7418"],["74708489.50d6ec"],["39a58d72.170e02"],["203562ec.0c25ae"]]},{"id":"b6faf5d5.7c7418","type":"api-call-service","z":"aaeb84d7.0184e","name":"Globe Lamp On","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.globe_lamp","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1300,"y":100,"wires":[[]]},{"id":"74708489.50d6ec","type":"api-call-service","z":"aaeb84d7.0184e","name":"Globe Lamp Off","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.globe_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1300,"y":180,"wires":[[]]},{"id":"a87d8825.26ae","type":"mqtt in","z":"aaeb84d7.0184e","name":"","topic":"zigbee2mqtt/dimmer_switch","qos":"2","datatype":"auto","broker":"aa4be58a.022348","x":120,"y":440,"wires":[["78e453c7.9945bc"]]},{"id":"78e453c7.9945bc","type":"json","z":"aaeb84d7.0184e","name":"","property":"payload","action":"","pretty":false,"x":350,"y":440,"wires":[["c549ca81.4567d8"]]},{"id":"c549ca81.4567d8","type":"switch","z":"aaeb84d7.0184e","name":"Action Group","property":"payload.action_group","propertyType":"msg","rules":[{"t":"eq","v":"145","vt":"str"},{"t":"eq","v":"146","vt":"str"},{"t":"eq","v":"147","vt":"str"},{"t":"eq","v":"148","vt":"str"},{"t":"eq","v":"149","vt":"str"},{"t":"eq","v":"150","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":550,"y":440,"wires":[["19e86797.74df68"],["554d3fbd.83552"],["f971500.a059e3"],[],[],["dc83a52a.ebbbd"]]},{"id":"e761fcc6.126918","type":"api-call-service","z":"aaeb84d7.0184e","name":"Table Light On","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.table_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":480,"wires":[[]]},{"id":"def34a71.2e91","type":"api-call-service","z":"aaeb84d7.0184e","name":"Table Light Off","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.table_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":560,"wires":[[]]},{"id":"554d3fbd.83552","type":"switch","z":"aaeb84d7.0184e","name":"On, off, up, down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":790,"y":420,"wires":[["e761fcc6.126918"],["def34a71.2e91"],["966ab9e7.ac57f8"],["8c093f91.1bc528"]]},{"id":"f971500.a059e3","type":"switch","z":"aaeb84d7.0184e","name":"On, off, up, down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":790,"y":540,"wires":[["72a5606.e3b1ea"],["999a5e12.a27c"],["d0d25051.502bd"],["8171040e.a6a83"]]},{"id":"999a5e12.a27c","type":"api-call-service","z":"aaeb84d7.0184e","name":"Warm Lamp Off","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.warm_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":920,"wires":[[]]},{"id":"72a5606.e3b1ea","type":"api-call-service","z":"aaeb84d7.0184e","name":"Warm Lamp On","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.warm_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":840,"wires":[[]]},{"id":"39a58d72.170e02","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.globe_lamp","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1350,"y":300,"wires":[["6d04ed67.8d2ba4"]]},{"id":"203562ec.0c25ae","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.globe_lamp","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1350,"y":360,"wires":[["ff1f2084.d678c"]]},{"id":"6d04ed67.8d2ba4","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload +32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness < 32) {\n brightness = 32;\n} else if (brightness >= 32 && brightness < 64) {\n brightness = 64;\n} else if (brightness >= 64 && brightness < 96) {\n brightness = 96;\n} else if (brightness >= 96 && brightness < 128) {\n brightness = 128;\n} else if (brightness >= 128 && brightness < 160) {\n brightness = 160;\n} else if (brightness >= 160 && brightness < 192) {\n brightness = 192;\n} else if (brightness >= 192 && brightness < 224) {\n brightness = 224;\n} else if (brightness >= 224) {\n brightness = 255;\n} \n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.globe_lamp', brightness: brightness}\n};\nreturn msg;","outputs":1,"noerr":0,"x":1750,"y":300,"wires":[["e0f2d5c3.4609b8"]]},{"id":"ff1f2084.d678c","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload -32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness > 224) {\n brightness = 224;\n} else if (brightness > 192 && brightness < 225) {\n brightness = 192;\n} else if (brightness > 160 && brightness < 193) {\n brightness = 160;\n} else if (brightness > 128 && brightness < 161) {\n brightness = 128;\n} else if (brightness > 96 && brightness < 129) {\n brightness = 96;\n} else if (brightness > 64 && brightness < 97) {\n brightness = 64;\n} else if (brightness > 32 && brightness < 65) {\n brightness = 32;\n} else if (brightness < 32) {\n brightness = 0;\n}\n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.globe_lamp', brightness: brightness}\n};\nreturn msg;\n","outputs":1,"noerr":0,"x":1750,"y":360,"wires":[["e0f2d5c3.4609b8"]]},{"id":"e0f2d5c3.4609b8","type":"api-call-service","z":"aaeb84d7.0184e","name":"Set Globe Lamp Brightness","server":"89080ee6.7112f8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.globe_lamp","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2100,"y":320,"wires":[[]]},{"id":"966ab9e7.ac57f8","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.table_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1330,"y":640,"wires":[["875314ca.42219"]]},{"id":"8c093f91.1bc528","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.table_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1330,"y":700,"wires":[["51b44048.cefec"]]},{"id":"875314ca.42219","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload +32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness < 32) {\n brightness = 32;\n} else if (brightness >= 32 && brightness < 64) {\n brightness = 64;\n} else if (brightness >= 64 && brightness < 96) {\n brightness = 96;\n} else if (brightness >= 96 && brightness < 128) {\n brightness = 128;\n} else if (brightness >= 128 && brightness < 160) {\n brightness = 160;\n} else if (brightness >= 160 && brightness < 192) {\n brightness = 192;\n} else if (brightness >= 192 && brightness < 224) {\n brightness = 224;\n} else if (brightness >= 224) {\n brightness = 255;\n} \n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.table_light', brightness: brightness}\n};\nreturn msg;","outputs":1,"noerr":0,"x":1750,"y":640,"wires":[["a053254b.03725"]]},{"id":"51b44048.cefec","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload -32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness > 224) {\n brightness = 224;\n} else if (brightness > 192 && brightness < 225) {\n brightness = 192;\n} else if (brightness > 160 && brightness < 193) {\n brightness = 160;\n} else if (brightness > 128 && brightness < 161) {\n brightness = 128;\n} else if (brightness > 96 && brightness < 129) {\n brightness = 96;\n} else if (brightness > 64 && brightness < 97) {\n brightness = 64;\n} else if (brightness > 32 && brightness < 65) {\n brightness = 32;\n} else if (brightness < 32) {\n brightness = 0;\n}\n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.table_light', brightness: brightness}\n};\nreturn msg;\n","outputs":1,"noerr":0,"x":1750,"y":700,"wires":[["a053254b.03725"]]},{"id":"a053254b.03725","type":"api-call-service","z":"aaeb84d7.0184e","name":"Set Table Light Brightness","server":"89080ee6.7112f8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.table_light","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2100,"y":660,"wires":[[]]},{"id":"d0d25051.502bd","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.warm_lamp","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1330,"y":1020,"wires":[["fbbacbfc.950a8"]]},{"id":"8171040e.a6a83","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.warm_lamp","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1330,"y":1080,"wires":[["a4f53a5c.f44c9"]]},{"id":"fbbacbfc.950a8","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload +32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness < 32) {\n brightness = 32;\n} else if (brightness >= 32 && brightness < 64) {\n brightness = 64;\n} else if (brightness >= 64 && brightness < 96) {\n brightness = 96;\n} else if (brightness >= 96 && brightness < 128) {\n brightness = 128;\n} else if (brightness >= 128 && brightness < 160) {\n brightness = 160;\n} else if (brightness >= 160 && brightness < 192) {\n brightness = 192;\n} else if (brightness >= 192 && brightness < 224) {\n brightness = 224;\n} else if (brightness >= 224) {\n brightness = 255;\n} \n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.warm_lamp', brightness: brightness}\n};\nreturn msg;","outputs":1,"noerr":0,"x":1750,"y":1020,"wires":[["b61b351c.c7bb2"]]},{"id":"a4f53a5c.f44c9","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload -32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness > 224) {\n brightness = 224;\n} else if (brightness > 192 && brightness < 225) {\n brightness = 192;\n} else if (brightness > 160 && brightness < 193) {\n brightness = 160;\n} else if (brightness > 128 && brightness < 161) {\n brightness = 128;\n} else if (brightness > 96 && brightness < 129) {\n brightness = 96;\n} else if (brightness > 64 && brightness < 97) {\n brightness = 64;\n} else if (brightness > 32 && brightness < 65) {\n brightness = 32;\n} else if (brightness < 32) {\n brightness = 0;\n}\n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.warm_lamp', brightness: brightness}\n};\nreturn msg;\n","outputs":1,"noerr":0,"x":1750,"y":1080,"wires":[["b61b351c.c7bb2"]]},{"id":"b61b351c.c7bb2","type":"api-call-service","z":"aaeb84d7.0184e","name":"Set Warm Lamp Brightness","server":"89080ee6.7112f8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.warm_lamp","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2100,"y":1040,"wires":[[]]},{"id":"dc83a52a.ebbbd","type":"switch","z":"aaeb84d7.0184e","name":"On, off, up, down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":790,"y":680,"wires":[["b0677ae6.cf7e28"],["c1933d28.5d41d"],[],[]]},{"id":"b0677ae6.cf7e28","type":"api-call-service","z":"aaeb84d7.0184e","name":"Group On","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"group.living_room","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":1220,"wires":[[]]},{"id":"c1933d28.5d41d","type":"api-call-service","z":"aaeb84d7.0184e","name":"Group Off","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"group.living_room","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":1280,"wires":[[]]},{"id":"34d61653.1cc8c2","type":"server","z":"","name":"Home Assistant instance","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"aa4be58a.022348","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"192.168.1.168","port":"1883","tls":"","clientid":"NodeRed","usetls":false,"compatmode":false,"keepalive":"300","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"/unxpected_disconnect","willQos":"0","willPayload":""},{"id":"89080ee6.7112f8","type":"server","z":"","name":"Home Assistant instance","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
1 Like

Hi, any update on this one?
The Trust ZYCT-202 seems a nice remote control at a very reasonable price if you can control (on/off/dim) up to 4 lights or light groups.
I’m curious if someone was able to use the remote on HA with Zigbee2MQTT as it was intend by the manufacturer for 4 lights.

see the node red flow I posted above – it works perfectly

Great, thanks, will order the device!

Hi,
I used your node-red flow and want to use it for a wall switch with on and off button.
So far On and off are working dimming will not work.
The debug node after the current state node gives state = on, while I should see the actual brightness. Is there something missing in your example flow?

This is mine:

[{"id":"aaeb84d7.0184e","type":"tab","label":"EcoDim WallSwitch","disabled":false,"info":""},{"id":"1ac57c78.e1f95c","type":"mqtt in","z":"aaeb84d7.0184e","name":"","topic":"zigbee2mqtt/Muurknop_Living","qos":"2","datatype":"auto","broker":"aa4be58a.022348","x":140,"y":120,"wires":[["a78131b.2a0c15"]]},{"id":"a78131b.2a0c15","type":"json","z":"aaeb84d7.0184e","name":"","property":"payload","action":"","pretty":false,"x":350,"y":120,"wires":[["e317f91d.4b0e08"]]},{"id":"e317f91d.4b0e08","type":"switch","z":"aaeb84d7.0184e","name":"1 On, off, up, down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on_1","vt":"str"},{"t":"eq","v":"off_1","vt":"str"},{"t":"eq","v":"brightness_move_up_1","vt":"str"},{"t":"eq","v":"brightness_move_down_1","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":550,"y":120,"wires":[["67d2aabc.bfb5c4"],["755eb9df.e9b27"],["613d42ed.470f7c"],["149d69d3.ae0a2e"]]},{"id":"67d2aabc.bfb5c4","type":"api-call-service","z":"aaeb84d7.0184e","name":"Zithoek lampen aan","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.alle_lampen_zithoek","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":830,"y":20,"wires":[[]]},{"id":"755eb9df.e9b27","type":"api-call-service","z":"aaeb84d7.0184e","name":"Zithoek lampen uit","server":"34d61653.1cc8c2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.alle_lampen_zithoek","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":830,"y":80,"wires":[[]]},{"id":"613d42ed.470f7c","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.alle_lampen_zithoek","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":900,"y":140,"wires":[["2822be5a.d700fa"]]},{"id":"2822be5a.d700fa","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload +32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness < 32) {\n brightness = 32;\n} else if (brightness >= 32 && brightness < 64) {\n brightness = 64;\n} else if (brightness >= 64 && brightness < 96) {\n brightness = 96;\n} else if (brightness >= 96 && brightness < 128) {\n brightness = 128;\n} else if (brightness >= 128 && brightness < 160) {\n brightness = 160;\n} else if (brightness >= 160 && brightness < 192) {\n brightness = 192;\n} else if (brightness >= 192 && brightness < 224) {\n brightness = 224;\n} else if (brightness >= 224) {\n brightness = 255;\n} \n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.alle_lampen_zithoek_lamp', brightness: brightness}\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1230,"y":140,"wires":[["67c18b74.dc3c84"]]},{"id":"67c18b74.dc3c84","type":"api-call-service","z":"aaeb84d7.0184e","name":"Set Alle_lampen_zithoek Brightness","server":"89080ee6.7112f8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.alle_lampen_zithoek","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1540,"y":160,"wires":[[]]},{"id":"149d69d3.ae0a2e","type":"api-current-state","z":"aaeb84d7.0184e","name":"","server":"89080ee6.7112f8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.alle_lampen_zithoek","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":900,"y":200,"wires":[["5e4da185.f7751"]]},{"id":"5e4da185.f7751","type":"function","z":"aaeb84d7.0184e","name":"Set brightness in payload -32","func":"var brightness = msg.data.attributes.brightness;\n\nif (brightness > 224) {\n brightness = 224;\n} else if (brightness > 192 && brightness < 225) {\n brightness = 192;\n} else if (brightness > 160 && brightness < 193) {\n brightness = 160;\n} else if (brightness > 128 && brightness < 161) {\n brightness = 128;\n} else if (brightness > 96 && brightness < 129) {\n brightness = 96;\n} else if (brightness > 64 && brightness < 97) {\n brightness = 64;\n} else if (brightness > 32 && brightness < 65) {\n brightness = 32;\n} else if (brightness < 32) {\n brightness = 0;\n}\n\nmsg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.globe_lamp', brightness: brightness}\n};\nreturn msg;\n","outputs":1,"noerr":0,"x":1210,"y":200,"wires":[["67c18b74.dc3c84"]]},{"id":"aa4be58a.022348","type":"mqtt-broker","name":"Mosquitto","broker":"localhost","port":"1883","tls":"","clientid":"NodeRed","usetls":false,"compatmode":false,"keepalive":"300","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"/unxpected_disconnect","willQos":"0","willPayload":""},{"id":"34d61653.1cc8c2","type":"server","name":"Home Assistant instance","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"89080ee6.7112f8","type":"server","name":"Home Assistant instance","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Thanks to have a look!