Page 1 of 1

Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 13:41
by fvdp80
A dzVents noob, with a noob question.

I'm trying to dim a Ikea TRadfri Bulb when the doorbell is pressed, but i keep on getting an error for the dimTo part.
If I only use the switchOn command the light will turn on. So that part is working.

Can anyone point me in the right direction?

Code: Select all

2020-01-04 13:37:22.930 Error: dzVents: Error: (2.5.3) An error occurred when calling event handler Deurbel
2020-01-04 13:37:22.931 Error: dzVents: Error: (2.5.3) ...i/domoticz/scripts/dzVents/generated_scripts/Deurbel.lua:10: attempt to call a nil value (field 'dimTo')

Code: Select all

return {
    active = true,
    on = {
        devices = {
            'Voordeur - Bel'
        }
    },
    execute = function(domoticz, Switch)
        if (Switch.state == 'Click' ) then
            domoticz.devices('Voordeur - Lamp').switchOn().dimTo(100)
            Switch.switchOff()
        end
    end
}

Re: Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 13:54
by waaren
fvdp80 wrote: Saturday 04 January 2020 13:41 I'm trying to dim a Ikea TRadfri Bulb when the doorbell is pressed, but i keep on getting an error for the dimTo part.
If I only use the switchOn command the light will turn on. So that part is working.
the dimTo > 0 does already imply a switchOn()

Code: Select all

return {
    active = true,
    on = {
        devices = {
            'Voordeur - Bel'
        }
    },
    execute = function(domoticz, Switch)
        
        if (Switch.state == 'Click' ) then
            domoticz.devices('Voordeur - Lamp').dimTo(100)
            Switch.switchOff().silent() -- to prevent a retrigger of the script
        end
    end
}

Re: Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 14:18
by fvdp80
If i only use dimTo(100) the light doesn't change to on, but no errors in the log.

Code: Select all

2020-01-04 14:15:45.588 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-04 14:15:45.591 (Zigbee2MQTT) MqttClient::publish zigbee2mqtt/0xec1bbdfffea8ae64/set ({"state": "OFF"})
2020-01-04 14:15:45.591 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-04 14:15:45.594 (Zigbee2MQTT) Command "Off (0)" from device "Voordeur - Bel"
2020-01-04 14:15:45.876 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0xec1bbdfffea8ae64 {'brightness': 51, 'state': 'OFF'}
2020-01-04 14:15:45.500 Status: dzVents: Info: Handling events for: "Voordeur - Bel", value: "Click"
2020-01-04 14:15:45.501 Status: dzVents: Info: ------ Start internal script: Deurbel: Device: "Voordeur - Bel (Zigbee2MQTT)", Index: 112
2020-01-04 14:15:45.513 Status: dzVents: Info: ------ Finished Deurbel
2020-01-04 14:15:45.523 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua

Re: Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 15:51
by waaren
fvdp80 wrote: Saturday 04 January 2020 14:18 If i only use dimTo(100) the light doesn't change to on, but no errors in the log.
To what type of hardware is the light connected ? If connected to a plugin type hardware then please report this to the developer of that plugin.

as workaround you could try

Code: Select all

return {
    active = true,
    on = {
        devices = {
            'Voordeur - Bel'
        }
    },
    execute = function(domoticz, Switch)
        
        if (Switch.state == 'Click' ) then
         domoticz.devices('Voordeur - Lamp').switchOn()
            domoticz.devices('Voordeur - Lamp').dimTo(100).afterSec(0.4)
            Switch.switchOff().silent() -- to prevent a retrigger of the script
        end
    end
}

Re: Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 16:25
by fvdp80
Again no luck.
The light turns on with the first command

Code: Select all

domoticz.devices('Voordeur - Lamp').switchOn()
But immediately turns off with the second command

Code: Select all

domoticz.devices('Voordeur - Lamp').dimTo(100).afterSec(0.4)
It's an Ikea Tradfri Bulb connected to Domoticz through Zigbee2MQTT plugin.

Re: Dim Ikea Tradfri Bulb

Posted: Saturday 04 January 2020 16:36
by waaren
fvdp80 wrote: Saturday 04 January 2020 16:25 Again no luck. The light turns on with the first command. But immediately turns off with the second command
It's an Ikea Tradfri Bulb connected to Domoticz through Zigbee2MQTT plugin.
what do you see in the domoticz log ?
And is there an option in this Zigbee2MQTT plugin to switch on extra debug logging?

Re: Dim Ikea Tradfri Bulb

Posted: Sunday 05 January 2020 14:09
by fvdp80
I've tried several command and lights which are controlled through the Zigbee2MQTT plugin and I found that the zigbee dimmer is
responding to the dimTo() command, but the Ikea Tradfri E27 bulb and the Tradfri GU10 bulb don't respond to that command. But I can
dim the Ikea lights with the slider.

I also made a blockly to switch on the Voordeur - Lamp to 80% and that works like a charm.

Below are the logs with loglevel enabled for Zigbee2MQTT plugin.

Domoticz log for the Ikea Tradfri Bulb through Zigbee2MQTT with Blocky (set level to 80%):
Spoiler: show

Code: Select all

2020-01-05 14:01:48.073 EventSystem: Event triggered: Test_1
2020-01-05 14:01:48.132 (Zigbee2MQTT) onCommand: Set Level, level (80) Color:
2020-01-05 14:01:48.134 (Zigbee2MQTT) MqttClient::publish zigbee2mqtt/0xec1bbdfffea8ae64/set ({"brightness": 204, "state": "ON"})
2020-01-05 14:01:48.345 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0xec1bbdfffea8ae64 {'brightness': 204, 'state': 'ON'}
Domoticz log for the Ikea Tradfri Bulb through Zigbee2MQTT with the dimTo(100) command:
Spoiler: show

Code: Select all

2020-01-05 13:39:59.485 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x00158d000290465b {'voltage': 3115, 'linkquality': 47, 'click': 'single', 'battery': 100}
2020-01-05 13:40:00.543 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-05 13:40:00.556 (Zigbee2MQTT) MqttClient::publish zigbee2mqtt/0xec1bbdfffea8ae64/set ({"state": "OFF"})
2020-01-05 13:40:00.745 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-05 13:40:00.750 (Zigbee2MQTT) Command "Off (0)" from device "Voordeur - Bel"
2020-01-05 13:40:00.352 Status: dzVents: Info: Handling events for: "Voordeur - Bel", value: "Click"
2020-01-05 13:40:00.352 Status: dzVents: Info: ------ Start internal script: Deurbel: Device: "Voordeur - Bel (Zigbee2MQTT)", Index: 112
2020-01-05 13:40:00.372 Status: dzVents: Info: ------ Finished Deurbel
2020-01-05 13:40:00.486 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-01-05 13:40:01.113 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0xec1bbdfffea8ae64 {'brightness': 51, 'state': 'OFF'}
Domoticz log for the Ikea Tradfri Bulb through Zigbee2MQTT with the switchOn() command:
Spoiler: show

Code: Select all

2020-01-05 13:48:09.875 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x00158d000290465b {'voltage': 3115, 'linkquality': 39, 'click': 'single', 'battery': 100}
2020-01-05 13:48:10.691 (Zigbee2MQTT) onCommand: On, level (0) Color:
2020-01-05 13:48:10.694 (Zigbee2MQTT) MqttClient::publish zigbee2mqtt/0xec1bbdfffea8ae64/set ({"state": "ON"})
2020-01-05 13:48:10.695 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-05 13:48:10.697 (Zigbee2MQTT) Command "Off (0)" from device "Voordeur - Bel"
2020-01-05 13:48:10.632 Status: dzVents: Info: Handling events for: "Voordeur - Bel", value: "Click"
2020-01-05 13:48:10.633 Status: dzVents: Info: ------ Start internal script: Deurbel: Device: "Voordeur - Bel (Zigbee2MQTT)", Index: 112
2020-01-05 13:48:10.643 Status: dzVents: Info: ------ Finished Deurbel
2020-01-05 13:48:10.651 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-01-05 13:48:11.390 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0xec1bbdfffea8ae64 {'brightness': 51, 'state': 'ON'}
Domoticz log for the Robbshop Zigbee dimmer through Zigbee2MQTT:
Spoiler: show

Code: Select all

2020-01-05 13:43:02.964 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x00158d000290465b {'voltage': 3115, 'linkquality': 42, 'click': 'single', 'battery': 100}
2020-01-05 13:43:03.724 (Zigbee2MQTT) onCommand: Set Level, level (100) Color:
2020-01-05 13:43:03.728 (Zigbee2MQTT) MqttClient::publish zigbee2mqtt/0x000d6f0013e899d0/set ({"brightness": 255, "state": "ON"})
2020-01-05 13:43:03.788 (Zigbee2MQTT) onCommand: Off, level (0) Color:
2020-01-05 13:43:03.790 (Zigbee2MQTT) Command "Off (0)" from device "Voordeur - Bel"
2020-01-05 13:43:03.690 Status: dzVents: Info: Handling events for: "Voordeur - Bel", value: "Click"
2020-01-05 13:43:03.690 Status: dzVents: Info: ------ Start internal script: Deurbel: Device: "Voordeur - Bel (Zigbee2MQTT)", Index: 112
2020-01-05 13:43:03.700 Status: dzVents: Info: ------ Finished Deurbel
2020-01-05 13:43:03.710 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-01-05 13:43:04.071 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x000d6f0013e899d0 {'brightness': 255, 'linkquality': 49, 'state': 'ON'}
2020-01-05 13:43:04.414 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x000d6f0013e899d0 {'brightness': 255, 'linkquality': 47, 'state': 'ON'}
2020-01-05 13:43:05.937 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x000d6f0013e899d0 {'brightness': 255, 'linkquality': 47, 'state': 'ON'}

Re: Dim Ikea Tradfri Bulb  [Solved]

Posted: Sunday 09 February 2020 16:40
by fvdp80
Don't know how, but after transferring to a new RPI with Buster and latest Domoticz Beta,
the dimTo() commmand is working for the Ikea Tradfri lights.