• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[8.1.2] kaku_dimmer unexpected reaction
#1
Hi,

I use a dimmers with kaku_dimmer protocol and changed my rules according the manual to pilight 8.1+ after upgrade from 8.0.6.

This rule works as expected:
Code:
"Dimmer_links_abends_aus": {
    "rule": "IF sw1.state == on AND manual.state == off AND (DATE_FORMAT(zeit, %H.%M) >= tagnacht.sunset) AND zeit.second == 0 THEN dim DEVICE spotli TO 0 FROM 15 IN '15 MINUTE' AFTER '8 SECOND'",
    "active": 1
},

This rule ignores the option IN '15 MINUTES' complete and dims without steps directly to 13:

Code:
"Dimmer_links_morgens_an": {
    "rule": "IF sw1.state == on AND manual.state == off THEN dim DEVICE spotli TO 13 FROM 0 IN '15 MINUTE' AFTER '8 SECOND'",
    "active": 1
},

This rule does absolutely nothing:

Code:
"Dimmer_links_aus_wenn_0": {
    "rule": "IF spotli.dimlevel == 0 AND spotli.state == on THEN switch DEVICE spotli TO off AFTER '2 SECOND'",
    "active": 1
},

Any hint what could be wrong?
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
#2
I will investigate.
 
Reply
#3
I just found out that rule 1 from my first post also does the same like rule 2.

The logfile shows this error every 1 minute (because of the second=0 in the rule):
Code:
[Sep 11 07:34:13:180756] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "13"

Device:
Code:
              "spotli": {
                       "protocol": [ "kaku_dimmer" ],
                       "id": [{
                               "id": 1175,
                               "unit": 0
                       }],
                       "state": "off",
                       "dimlevel-minimum": 0,
                       "dimlevel-maximum": 15,
                       "dimlevel": 9
               },
Before stopping the pilight service the dimlevel in GUI was 0, after restart it wents back to the last state (9) before the rule started.

Gui:

Code:
               "spotli": {
                       "name": "SPOT links",
                       "group": [ "aktueller Status" ],
                       "media": [ "all" ]
               },

Maybe this info will help you.
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
#4
I've tested your config and i don't experience any issues:
Code:
{
    "devices": {
        "dimmer": {
            "protocol": [ "kaku_dimmer" ],
            "id": [{
                "id": 1175,
                "unit": 0
            }],
            "state": "off",
            "dimlevel-minimum": 0,
            "dimlevel-maximum": 15,
            "dimlevel": 1
        },
        "switch": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 1
            }],
            "state": "on"
        }
    },
    "rules": {
        "foo": {
            "rule": "IF switch.state == on THEN dim DEVICE dimmer TO 13 FROM 0 IN '15 SECOND' AFTER '3 SECOND'",
            "active": 1
        }
    },
    "gui": {
        "dimmer": {
            "name": "Foo",
            "group": [ "Main" ],
            "media": [ "all" ]
        },
        "switch": {
            "name": "Bar",
            "group": [ "Main" ],
            "media": [ "all" ]
        }
    },
    "settings": {},
    "hardware": {},
    "registry": {}
}

The rule can be triggered by switching the generic_switch between off and on.

The rule works expected here. And setting a kaku_dimmer to 0 is the same as setting it to off.

What was the last version you used before 8.1.2?



And now it stopped working Confused



And i found the issue.

You can fix the issue for now by changing this line:
Code:
data['direction'] = tonumber(from_dimlevel) > tonumber(new_dimlevel);
to
Code:
data['direction'] = tonumber(tonumber(from_dimlevel) > tonumber(new_dimlevel));
in /usr/local/lib/pilight/actions/dim.lua
 
Reply
#5
The latest version i used was 8.0.6
There it worked, but i had to switch off the dimmer also manually from 0 with switch.

Do you also have the same error message in loop?
This repeats until restarting the service
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
#6
I changed the line according your post now, generated a testrule.

Code:
               if from_dimlevel ~= nil then
                       data['direction'] = tonumber(tonumber(from_dimlevel) > tonumber(new_dimlevel));
               end


The issue is still here.

Rule starts when switching, dimmer goes directly to the endpoint found in the rule, after a few seconds dimmer switches back to 0 (visually but gui shows 5), error in the logfile loops.

Testrule:
Code:
"99-Testregel": {
       "rule": "IF sw1.state == off AND sw2.state == on THEN dim DEVICE spotli TO '5' FROM '0' IN '30 SECOND' AFTER '5 SECOND'",
       "active": 1
      },

Logfile:

Code:
[ Sep 11 21:09:33:31410] pilight-daemon: INFO: sunriseset tagnacht 13.904440:48.315277 seems to be in timezone: Europe/Prague
[ Sep 11 21:09:33:63293] pilight-daemon: INFO: datetime zeit 13.904440:48.315277 seems to be in timezone: Europe/Prague
[Sep 11 21:09:33:260109] pilight-daemon: INFO: rule #1 Neonlicht_morgens_an was parsed in 0.074990 seconds
[Sep 11 21:09:33:300855] pilight-daemon: INFO: rule #2 Neonlicht_abends_aus was parsed in 0.040576 seconds
[Sep 11 21:09:33:321963] pilight-daemon: INFO: rule #3 Dimmer_links_morgens_an was parsed in 0.020938 seconds
[Sep 11 21:09:33:343471] pilight-daemon: INFO: rule #4 Dimmer_rechts_morgens_an was parsed in 0.021336 seconds
[Sep 11 21:09:33:381734] pilight-daemon: INFO: rule #5 Dimmer_links_abends_aus was parsed in 0.038092 seconds
[Sep 11 21:09:33:420319] pilight-daemon: INFO: rule #6 Dimmer_rechts_abends_aus was parsed in 0.038414 seconds
[Sep 11 21:09:33:438890] pilight-daemon: INFO: rule #7 Dimmer_links_aus_wenn_0 was parsed in 0.018400 seconds
[Sep 11 21:09:33:457665] pilight-daemon: INFO: rule #8 Dimmer_rechts_aus_wenn_0 was parsed in 0.018490 seconds
[Sep 11 21:09:33:478891] pilight-daemon: INFO: rule #9 99-Testregel was parsed in 0.021056 seconds
[Sep 11 21:09:33:494576] pilight-daemon: INFO: version v8.1.2-nightly-271a0ade
[Sep 11 21:09:33:533909] pilight-daemon: INFO: daemon listening to port: 5000
[Sep 11 21:09:33:583331] pilight-daemon: INFO: secured webserver started on port: 5002 (fd 13)
[Sep 11 21:09:33:583651] pilight-daemon: INFO: regular webserver started on port: 5001 (fd 14)
[Sep 11 21:09:33:621904] pilight-daemon: INFO: new client, ip: 127.0.0.1, port: 34894
[Sep 11 21:09:33:738414] pilight-daemon: NOTICE: no pilight ssdp connections found
[Sep 11 21:09:33:739425] pilight-daemon: INFO: new client, ip: 127.0.0.1, port: 34896
[Sep 11 21:10:25:982285] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:31:981960] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:37:981817] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:43:981615] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:49:981693] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:55:982527] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:10:57:887778] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:01:982448] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:03:887947] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:07:981977] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:09:887879] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:13:981616] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:15:888715] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:19:982857] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:21:888615] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:25:982583] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:27:889073] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:216: device "spotli" could not be set to dimlevel "5"
[Sep 11 21:11:31:759189] pilight-daemon: INFO: Interrupt signal received. Please wait while pilight is shutting down
[Sep 11 21:11:31:770897] pilight-daemon: INFO: removed stale pid_file /var/run/pilight.pid
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
#7
I'm working on it. It's indeed something that was not tested for previously. Dimming down was, up wasn't.
 
Reply
#8
Alright, i will wait.
In principle, however, with these new functions i should be able to simulate a sunrise and a sunset with step by step dimming or am i wrong?
(from 0 to 15 in 15 minutes = 1 Step every minute?)
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
#9
This functionality has been in pilight for ages Smile

But, indeed, you should be able to mimic sunrise/sunset with this.



Can you check the latest nightly. I did some fixes again.
 
Reply
#10
I tested with v8.1.2-nightly-441c89a5.
Same reaction with the rule but the error in the logfile has changed now:


Code:
[Sep 13 00:30:10:657737] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:220: device "spotli" could not be set to dimlevel "-1"
[Sep 13 00:30:16:657107] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:220: device "spotli" could not be set to dimlevel "-1"
[Sep 13 00:30:22:657349] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:220: device "spotli" could not be set to dimlevel "-1"
[Sep 13 00:30:28:657145] pilight-daemon: ERROR: /usr/local/lib/pilight/actions/dim.lua:220: device "spotli" could not be set to dimlevel "-1"
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)