Color and brightness with a zigbee lamp  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Color and brightness with a zigbee lamp

Post by domogijs »

ok thanks, saved it as dzVents

but still get errors.

error:


2019-07-06 12:28:33.363 Error: dzVents: local netWork not open for dzVents openURL call !
2019-07-06 12:28:33.363 Error: dzVents: check dzVents wiki (look for 'Using dzVents with Domoticz')

script

Code: Select all

return {
    on = { devices = { "ThermSwitch" }},
    
    execute = function(dz, item)
        Ikea = dz.devices(793)
        
        if item.active then
            Ikea.setRGB(100,100,0)
        else
            Ikea.switchOff()
        end
    end
}
any ideas?
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Color and brightness with a zigbee lamp

Post by EddyG »

And did you do the hint from the error message: look in the wiki and do some stuff?
domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Color and brightness with a zigbee lamp

Post by domogijs »

;) yes i get the hint and i did some stuff

the rgb setting seems fine; wiki setRGB(red, green, blue): Function. 2.4.0 Set the lamps RGB color. Values are from 0-255. Supports command options.

i just dont get the openUrl part. I am not using it in the script.

openURL(url/options): Function. Have Domoticz 'call' a URL. If you just pass a url then Domoticz will execute the url after your script has finished but you will not get notified. If you pass a table with options then you have to possibility to receive the results of the request in a dzVents script. Read more about asynchronous http requests2.4.0 with dzVents. Supports command options.

are you willing to give a hint?
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Color and brightness with a zigbee lamp

Post by waaren »

domogijs wrote: Saturday 06 July 2019 15:11 are you willing to give a hint?
The error message asks you to goto the wiki and look for "Using dzVents with Domoticz"
If you do that you will read:
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the check-box 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings (Setup > Settings > System > Local Networks (no username/password) you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state.
"
Fact that you don't use openURL in your script explicitly does not mean dzVents is not using it to 'send certain commands to Domoticz'
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Color and brightness with a zigbee lamp

Post by domogijs »

Thanks! That solved the error, i will rtfm better in the future :)

But now i have a new error :

Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... :100,"b":5}


I tried this in the browser:

http://192.168.178.19:8080/json.htm?typ ... es&rid=392 (works)
http://127.0.0.1:8080/json.htm?type=devices&rid=392 (doesnt work)

with ifconfig on the pi i get this. I seem to listen on that adres

Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:40 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2840 (2.7 KiB) TX bytes:2840 (2.7 KiB)


With netstat -anl|grep -i "listen"|grep -i "tcp" i get this. no 8080



tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1880 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 :::6144 :::* LISTEN



In dont know anymore what to try next. Any ideas?

Greets Gijs
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Color and brightness with a zigbee lamp

Post by waaren »

domogijs wrote: Sunday 07 July 2019 14:40 I have a new error :
Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... :100,"b":5}
What do you see if you give

Code: Select all

sudo curl -s 'http://127.0.0.1:8080/json.htm?type=devices' | grep version
from the CLI ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Color and brightness with a zigbee lamp

Post by domogijs »

Hi waaren thanks for the help

I see :

pi@raspberrypi:~$ sudo curl -s 'http://127.0.0.1:8080/json.htm?type=devices'
Unauthorized

401 Unauthorized

pi@raspberrypi:~$ 

Greets Gijs
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Color and brightness with a zigbee lamp

Post by waaren »

domogijs wrote: Sunday 07 July 2019 23:22 pi@raspberrypi:~$ sudo curl -s 'http://127.0.0.1:8080/json.htm?type=devices'
Unauthorized
Can you try and modify the local networks settings in the domoticz gui ?

Setup -> Settings -> System setup -> local networks (NO USERNAME/PASSWORD) field filled with "127.0.0.*;192.168.178.*"
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Color and brightness with a zigbee lamp  [Solved]

Post by domogijs »

yes! it works. Thanks!
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest