Lightwave Generation 2 component

@bigbadblunt Thanks a lot for this, its working really great.

With the new v5 firmware for the lightwave.click event that are now generated, I’ve been wondering how best to monitor it - see Node-RED example below.
I’ve created some cool automation using Node-RED with utilising ‘attributes: lwrf_uiButtonPair’ with their respective code:

Code Hex Meaning
257 101 Up button single press
258 102 Up button double press
259 103 Up button triple press
260 104 Up button quad press
512 200 Up button press and hold
768 300 Up button release after long press
4353 1101 Down button single press
4354 1102 Down button double press
4355 1103 Down button triple press
4356 1104 Down button quad press
4608 1200 Down button press and hold
4864 1300 Down button release after long press

I couldn’t find any reference to ‘lightwave.click’ events in HA, mentioned in the github page?

The only issue I have with the way I’ve been monitoring the attribute changes, is that you only get that state attribute once (eg code 259 - up button pushed three time).
You wont get another state poll unless the ‘attribute: lwrf_uiButtonPair’ value has changed - I had no choice but to add the old_state to new_state comparison: if I operate the dimmer remotely, it would then initiate the three button automation when I wouldn’t want it to do so…

Node-RED example:
Push the up button three times (code 259) initiates my robot vacuum for that particular room and push the down button three times (code 4355) will send the vacuum back to the docking station.

[
    {
        "id": "8a2ded8dcece8ea1",
        "type": "server-state-changed",
        "z": "29ad2c77b6792cef",
        "name": "Living Room",
        "server": "a3c259717ed73a08",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "light.living_room_lights_v2",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": false,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 290,
        "y": 100,
        "wires": [
            [
                "ba408f9855393a6a"
            ]
        ]
    },
    {
        "id": "c1174516c3562c28",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is UP button pushed three times?",
        "property": "data.new_state.attributes.lwrf_uiButtonPair",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "259",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 640,
        "y": 60,
        "wires": [
            [
                "d18b170166f6e3cc"
            ]
        ]
    },
    {
        "id": "ba408f9855393a6a",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "",
        "property": "data.new_state.attributes.lwrf_uiButtonPair",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "data.old_state.attributes.lwrf_uiButtonPair",
                "vt": "msg"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 415,
        "y": 100,
        "wires": [
            [
                "c1174516c3562c28",
                "5661a17e0f84bd58"
            ]
        ],
        "l": false
    },
    {
        "id": "c2082be92a4fa71f",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Send Cleany home",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "toggle",
        "entityId": "script.send_cleany_back_home",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "5661a17e0f84bd58",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is DOWN button pushed three times?",
        "property": "data.new_state.attributes.lwrf_uiButtonPair",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "4355",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 650,
        "y": 120,
        "wires": [
            [
                "c2082be92a4fa71f"
            ]
        ]
    },
    {
        "id": "d18b170166f6e3cc",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Clean living room",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "toggle",
        "entityId": "script.clean_livingroom",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "a3c259717ed73a08",
        "type": "server",
        "name": "Home Assistant",
        "version": 1,
        "legacy": false,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]
1 Like

To see the events, in HA go to Developer-tools->events: here’s an example

You can use this in a HA automation with an “event” trigger. I’ve no idea how to connect this to Node-RED.

1 Like

PS this will fire two events even if it’s the same type of event - e.g. here’s a “down button single press” twice in a row

1 Like

@bigbadblunt

Thanks a lot for that, I’m glad I was on the right page: I did give that a go in the developers tool and subscribe to lightwave2.click but for some reason I cant see any of the fired events when pushing any of the dimmer buttons?

Would this be because I am not using the API with your integration?

Are you using the latest beta version of the component?

Oh I see that’s the reason why: I was on 3.2.2, I’ve just enabled the beta version and updated it.
I will have a play with it later. Thanks for your help.

HA Automation 2-way Lighting with Brightness control

I’ve also written two automations that work together in HA to simulate the 2 way lighting, I found ever since the v5 firmware: the built-in lightwave 2-way automation to be quite sluggish and not always responsive when operating the slave dimmer.
The latest v5.06 firmware may have sorted the issue but I’ve not tested it and kept using the HA automation: additionally it also gets rid of the multi-press green line indicator when operating the slave dimmer which I didnt like after updating to v5.

EDIT: Forgot to mention, you have to have both dimmers set as a master - with only one of the dimmers actually operating the light (Master) the other dimmer (Slave) will have nothing connected to its channel.

I’m using data_template to mirror the brightness for my landing lights and hall lights dimmer

alias: Landing Brightness Mirror (Working)
description: ''
trigger:
  - platform: state
    entity_id: light.landing_lights
    attribute: brightness
  - platform: state
    entity_id: light.hall_lights_2
    attribute: brightness
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: light.landing_lights
        state: 'on'
      - condition: state
        entity_id: light.hall_lights_2
        state: 'on'
action:
  - service: light.turn_on
    data_template:
      entity_id: >-
        {% if trigger.from_state.entity_id == "light.hall_lights_2" %}
        light.landing_lights {% elif trigger.from_state.entity_id ==
        "light.landing_lights" %} light.hall_lights_2 {% endif %}
      brightness: >-
        {% if trigger.from_state.entity_id == "light.landing_lights" %} {{
        states.light.landing_lights.attributes.brightness }} {% elif
        trigger.from_state.entity_id == "light.hall_lights_2" %} {{
        states.light.hall_lights_2.attributes.brightness }} {% endif %}
mode: single

This automation is then used for replicating the 2 way operation of the lightwave, it prevents a continuous loop by preventing multiple triggers.

alias: Landing Lights Mirror
description: ''
trigger:
  - platform: state
    entity_id: light.hall_lights_2, light.landing_lights
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: light.hall_lights_2, light.landing_lights
    from: 'on'
    to: 'off'
condition: []
action:
  - service_template: >-
      {% if trigger.to_state.state == "on" %} light.turn_on {% elif
      trigger.to_state.state == "off" %} light.turn_off {% endif %}
    data_template:
      entity_id: >-
        {% if trigger.from_state.entity_id == "light.hall_lights_2" %}
        light.landing_lights {% elif trigger.from_state.entity_id ==
        "light.landing_lights" %} light.hall_lights_2 {% endif %}
mode: single

1 Like

All working great now with the lightwave2.click event.

For anyone interested in how it can be done with Node-RED, I’ve put an example below:

[
    {
        "id": "bf17535f49a25a6c",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is UP button pushed two times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "258",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 650,
        "y": 1860,
        "wires": [
            [
                "b636e0bb1579c1c0"
            ]
        ]
    },
    {
        "id": "681d37730f3439d9",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is DOWN button pushed two times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "4354",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 660,
        "y": 1920,
        "wires": [
            [
                "2611a3199797abdb"
            ]
        ]
    },
    {
        "id": "b636e0bb1579c1c0",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Turn On Dining Lights",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "turn_on",
        "entityId": "light.dining_room_4",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 960,
        "y": 1860,
        "wires": [
            []
        ]
    },
    {
        "id": "2611a3199797abdb",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Turn Off Dining Lights",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "turn_off",
        "entityId": "light.dining_room_4",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 960,
        "y": 1920,
        "wires": [
            []
        ]
    },
    {
        "id": "62e45644d12d8982",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is UP button pushed four times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "260",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 650,
        "y": 2140,
        "wires": [
            [
                "db6229dcefabd953"
            ]
        ]
    },
    {
        "id": "c19b302c88791850",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is DOWN button pushed four times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "4356",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 670,
        "y": 2200,
        "wires": [
            [
                "0542b5aab9245e2e"
            ]
        ]
    },
    {
        "id": "db6229dcefabd953",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Turn On Dining Fan",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "turn_on",
        "entityId": "light.dining_room_2",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 950,
        "y": 2140,
        "wires": [
            []
        ]
    },
    {
        "id": "0542b5aab9245e2e",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Turn Off Dining Fan",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "turn_off",
        "entityId": "light.dining_room_2",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 950,
        "y": 2200,
        "wires": [
            []
        ]
    },
    {
        "id": "5fd44d2f8412d7c9",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is UP button pushed three times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "259",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 660,
        "y": 2000,
        "wires": [
            [
                "80b593420068f27f"
            ]
        ]
    },
    {
        "id": "9eea44fd1d5e5924",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Send Cleany home",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "toggle",
        "entityId": "script.send_cleany_back_home",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 950,
        "y": 2060,
        "wires": [
            []
        ]
    },
    {
        "id": "c503357e4d29ab1f",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "Is DOWN button pushed three times?",
        "property": "payload.event.code",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "4355",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 670,
        "y": 2060,
        "wires": [
            [
                "9eea44fd1d5e5924"
            ]
        ]
    },
    {
        "id": "80b593420068f27f",
        "type": "api-call-service",
        "z": "29ad2c77b6792cef",
        "name": "Clean Dining",
        "server": "a3c259717ed73a08",
        "version": 3,
        "debugenabled": false,
        "service_domain": "homeassistant",
        "service": "toggle",
        "entityId": "script.clean_diningroom",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 2000,
        "wires": [
            []
        ]
    },
    {
        "id": "09d0e3eb2d83549a",
        "type": "switch",
        "z": "29ad2c77b6792cef",
        "name": "",
        "property": "payload.event.entity_id",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "light.kitchen_lights_3_v2",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 410,
        "y": 2040,
        "wires": [
            [
                "bf17535f49a25a6c",
                "681d37730f3439d9",
                "5fd44d2f8412d7c9",
                "c503357e4d29ab1f",
                "62e45644d12d8982",
                "c19b302c88791850"
            ]
        ]
    },
    {
        "id": "9c1b2a27ae44e61b",
        "type": "server-events",
        "z": "29ad2c77b6792cef",
        "name": "",
        "server": "a3c259717ed73a08",
        "version": 1,
        "event_type": "lightwave2.click",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "waitForRunning": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            }
        ],
        "x": 220,
        "y": 2040,
        "wires": [
            [
                "09d0e3eb2d83549a"
            ]
        ]
    },
    {
        "id": "e65723724f5e4dd1",
        "type": "comment",
        "z": "29ad2c77b6792cef",
        "name": "Dining Commands",
        "info": "",
        "x": 630,
        "y": 1820,
        "wires": []
    },
    {
        "id": "a3c259717ed73a08",
        "type": "server",
        "name": "Home Assistant",
        "version": 1,
        "legacy": false,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]

Anyone got these switches to play nice with colour changing bulbs such as Hue? I’m getting terrible flicker unless I set the min max load to the same values.

Another way to do this is to just use buttons as controllers for HA actions? I.e, rather than actually dimming the light, I would like it to send a command to HA which in turn could then tell my hue bulbs to turn off. Not sure if this is possible though?

Seems we can use the button mapping feature by toggling uiIOMap between 256/257

Excellent integration that I have been using for a while however I have a couple of questions. Any assistance greatly appreciated.

  1. How do you remove obsolete devices? For example I had a number of the Lightwave radiator controls (LW922) however I have replaced them with the Honeywell options. Even though the old LW922 are deleted from the Lightwave app - they still show in HA. Restart finds new devices but never removes the old.

  2. I have been testing the use of lightwave2.set_brightness. This works well on single dimmers however on a double (L22MK2) using this service call on the 2nd channel causes the 1st channel to also change brightness. Is this something that i am doing wrong?

service: lightwave2.set_brightness
data:
  entity_id: light.main_2
  brightness: 255

#1 I don’t know a good answer - I think this is a more general HA question. You can disable entities through the web interface. To permanently delete them, the only way I’ve found is to manually edit the .storage/device_registry and .storage/entity_registry files.

#2 can you turn on debugging and send me the log files? I don’t have any gen2 2-gang switches so can’t reproduce.

On #1 I implemented some new code to remove redundant devices. See the latest beta version.

Thanks, this beta code worked perfectly and removed the orphaned devices.

On the other point I have sent you the latest log file. It is over 2Mb so please let me know if you don’t get it. I did however get these general log errors show in home assistant

A few additional items:

on devices with more than one channel the integration does not know the model information. Not a problem normally but could be a challenge for blue prints looking for specific hardware models.

I now have these warnings on the HR92 heat TRVs which I had not noticed before. 7 warnings - 7 devices.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 3:42:03 PM (7 occurrences)
Last logged: 3:42:03 PM

Entity binary_sensor.box_room_rad (<class 'custom_components.lightwave2.binary_sensor.LWRF2BinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity binary_sensor.living_room_rad (<class 'custom_components.lightwave2.binary_sensor.LWRF2BinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity binary_sensor.study_radiator (<class 'custom_components.lightwave2.binary_sensor.LWRF2BinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity binary_sensor.hall_radiatoradiator (<class 'custom_components.lightwave2.binary_sensor.LWRF2BinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity binary_sensor.dining_room_rad (<class 'custom_components.lightwave2.binary_sensor.LWRF2BinarySensor'>) implements device_state_attributes. Please report it to the custom component author.

I can test code changes and I will be working on some Blueprints for the multiple button press options.

Thanks
Adrian

OK, I just released a new beta version on github. Hopefully this fixes:

a. Your problem with the set_brightness call
b. product codes/model information missing for some devices
c. the binary_sensor warnings

Let me know if these work for you.

I can’t reproduce the “doesn’t generate unique ids” errors. If those persist, please send me the logs.

Many thanks, I can confirm that all three items are now working but I will continue to test.

I have not seen the ID error again so far.

Hi all,

Am looking for a smart dimmer solution for the home and this looks great!

I wanted to ask, on the manufacturer’s site, it talks of “premium features” they sell off for 80 quid a year. Can we get around this using home assistant locally? Lightwave PLUS Benefits – Lightwave

I love the idea of a double button press etc = automation for the room (would be cool in the living room for the TV). Id hate to buy an expensive system to just be locked behind a paywall :frowning:

If possible (though i see some talk above it) can someone tell me if this all works locally with no need for an internet connection and if any what features I would miss out on?

let me know if you can, thanks :slight_smile:

Things you don’t need a subscription for:

  • Control via cloud (lightwave servers) of normal device functions (on/off/dim)
  • Local control (via Homekit) - this may have some limitations, I’ve not used it, but for lights I think you should be able to control all functions
  • Detecting multi press events (via cloud)
  • Using Home Assistant to trigger automations based on multi press events

Things you should need a subscription for, but apparently don’t

  • Disconnecting the physical device from the buttons; this is useful if you want to be able to press the buttons on a light switch to trigger automations but to not have the lights turn on or off. The Lightwave app says that this feature is restricted to subscribers, but the app still lets you make changes. Maybe they’ll patch this out in future.

Things you need a subscription for:

  • Using the lightwave hub to trigger automations based on multi press events (but no problem - you can use Home Assistant)
  • Changing the dimming profile of light switches
1 Like

Just remembered one more.

Things you don’t need a subscription for:

  • Changing the colour of the LED indicator on the physical unit. This can only be done via the cloud, no local control. You might want to use this in automations to act as an indicator. The LED can be set to 6 different colours and dimmed.
1 Like

Thanks, dude! This is helpful. (makes me a bit happy to buy them)

I got some other questions if you don’t mind?

Do I need to buy the hub, If I plan to use this offline only with home assistant running locally? or is it seen as the central device as such and the home assistant controls that (not each lightwave dimmer directly) via the local API.

You mention home kit above, as well as home assistant, so just to confirm, It all works locally with the home assistant? (if not deal breaker am afraid) :confused:

cheers!