Giter Site home page Giter Site logo

Comments (7)

Supergiovane avatar Supergiovane commented on September 21, 2024

Hi, i'm taking a look at the user manual...

from node-red-contrib-knx-ultimate.

ColdFireIce avatar ColdFireIce commented on September 21, 2024

Excellent. If I can support you, let me know!

from node-red-contrib-knx-ultimate.

Supergiovane avatar Supergiovane commented on September 21, 2024

Hi Cold, what's your name? I'm Max.
Basically, it works like the "tunable white" controls, but with HUE, Saturation and brightness and with slight changes to the statuses GA.

Node-RED___192_168_1_16

I'll work on that.
The main issue is to retrieve and read the HUE color wheel.
Can you share here some code you used, to let me save some time?

from node-red-contrib-knx-ultimate.

ColdFireIce avatar ColdFireIce commented on September 21, 2024

Hi Max,

yes I think this is basically the case for saturation and brightness.
For Hue its the degree on an color wheel.
My current implementation is far from perfect, but basically it works like this:

  • Use hue lamp current color (in my case, saved in an subflow)
  • Change the values
  • Convert HSV -> RGB
  • Set RGB to hue lamp

My code looks like this:

[{"id":"0f254daf2271a72b","type":"looptimer2","z":"cc2d22b7145c4de5","duration":"0.5","units":"Second","maxloops":"100","maxtimeout":"1","maxtimeoutunits":"Minute","name":"","x":370,"y":220,"wires":[["3957120ceaf4e1e7","c647e9e28f005820"],["be82a6b2865fca59"]]},{"id":"939b714536929f5d","type":"function","z":"cc2d22b7145c4de5","name":"","func":"if (msg.payload.data === 0) {\n    return {payload:\"STOP\"}\n} else {\n    let sign = (msg.payload.decr_incr === 0) ? -1 : 1;\n    return {payload: sign * msg.payload.data * 10}\n}\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":180,"y":220,"wires":[["0f254daf2271a72b"]]},{"id":"3957120ceaf4e1e7","type":"function","z":"cc2d22b7145c4de5","name":"hue -> HSV","func":"let flowHue = flow.get(\"colorHue\")\n\nlet hue = flowHue ? ((flow.get(\"colorHue\") + msg.payload) % 360) : 0\nhue = (hue < 0) ? hue +360 : hue; \nflow.set(\"colorHue\", hue)\n\nreturn {payload: [hue, 100, 100]};","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":220,"wires":[["bf38073094f528a7"]]},{"id":"bf38073094f528a7","type":"color-convert","z":"cc2d22b7145c4de5","input":"hsv","output":"rgb","outputType":"array","scaleInput":true,"x":1010,"y":220,"wires":[["cd866f929ab6820b"]]},{"id":"cd866f929ab6820b","type":"function","z":"cc2d22b7145c4de5","name":"-> payload.rgb","func":"\nreturn {payload: {rgb: msg.payload}};","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":220,"wires":[[]]},{"id":"c647e9e28f005820","type":"change","z":"cc2d22b7145c4de5","name":"","rules":[{"t":"set","p":"running","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":200,"wires":[[]]},{"id":"be82a6b2865fca59","type":"change","z":"cc2d22b7145c4de5","name":"","rules":[{"t":"set","p":"running","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":260,"wires":[[]]}]

For saving the hue value I just convert the hue lamps RGB to HSV and save the H part:

[{"id":"52cfe893.a0bdc8","type":"change","z":"c73b7b76.eb5d18","name":"","rules":[{"t":"set","p":"colorHue","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":180,"wires":[[]]},{"id":"7f8a301e.f01a9","type":"color-convert","z":"c73b7b76.eb5d18","input":"rgb","output":"hsv","outputType":"array","scaleInput":false,"x":570,"y":180,"wires":[["419aeeac.de433"]]},{"id":"681f3a71.db4c64","type":"function","z":"c73b7b76.eb5d18","name":"payload.rgb ->","func":"return {payload: msg.payload.rgb};","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":180,"wires":[["7f8a301e.f01a9"]]},{"id":"419aeeac.de433","type":"function","z":"c73b7b76.eb5d18","name":"payload[0]","func":"\nreturn {payload: msg.payload[0]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":180,"wires":[["fc1d950e.aaefb8"]]},{"id":"fc1d950e.aaefb8","type":"switch","z":"c73b7b76.eb5d18","name":"","property":"running","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":180,"wires":[[],["52cfe893.a0bdc8"]]}]

I hope this helps a little bit.

Best regards
Daniel

from node-red-contrib-knx-ultimate.

ColdFireIce avatar ColdFireIce commented on September 21, 2024

A thing on the side:
I played around with the HA template and noticed, that it is currently not possible to have color and tuneable white:
https://community.home-assistant.io/t/solved-flapping-states-knx-light-card/667139/12
There are versions for https://www.home-assistant.io/integrations/knx/#rgbw_address
but I don't have any KNX lights that support that.

I thought I share my findings as soon as possible for you.

from node-red-contrib-knx-ultimate.

Supergiovane avatar Supergiovane commented on September 21, 2024

Hi
Do you have your MDT set like this?
https://youtu.be/cx85Y5eTSHQ?t=528

from node-red-contrib-knx-ultimate.

Supergiovane avatar Supergiovane commented on September 21, 2024

Out in 2.4.5-beta.1 https://github.com/Supergiovane/node-red-contrib-knx-ultimate/milestone/24

from node-red-contrib-knx-ultimate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.