[Plugin now available in Beta] Help with Yeelight Bulb

superczar
Posts: 90
Joined: Wednesday 14 January 2015 13:08
Target OS: Raspberry Pi
Domoticz version:
Location: India
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by superczar » Tuesday 06 June 2017 11:14

Isn't the value for otherdevices_svalues numeric?
In any case, the code is practically as -is from the wiki

User avatar
corbin
Posts: 495
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by corbin » Tuesday 06 June 2017 18:05

see what value is returning for DomValue with "print(DomValue)":

Code: Select all

commandArray = {}
DomDevice = 'White Temp Yeelight';
IP = '192.168.5.14';
PORT = '55443'
 
if devicechanged[DomDevice] then
   if(devicechanged[DomDevice]=='Off') then 
     DomValue = 0;
     runcommandoff = "sudo echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";;
     os.execute(runcommandoff);
   else
     DomValue = otherdevices_svalues[DomDevice];   
     print(DomValue)
   CalcValue = ((DomValue-1) * 48)+1700;
   end
   if CalcValue==nil then CalcValue=0 end
     runcommand = " sudo echo -ne '{\"id\":1, \"method\":\"set_scene\",\"params\":[\"ct\"," .. CalcValue .. ", 75]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
   os.execute(runcommand);
   print(runcommand)
   print("Color Temp= "..CalcValue);
end
return commandArray
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)

User avatar
Westcott
Posts: 535
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by Westcott » Tuesday 06 June 2017 18:20

Perhaps it should be -
DomValue = tonumber(otherdevices_svalues[DomDevice])
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001, Horstmann - 2x HRT4, 2x C-stat-11,
4x ASR-ZW, Aeon Micro Switch, 2x TKB TZ68E
Max-EQ Cube, Valve
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

superczar
Posts: 90
Joined: Wednesday 14 January 2015 13:08
Target OS: Raspberry Pi
Domoticz version:
Location: India
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by superczar » Thursday 08 June 2017 9:06

@westcott - Making the change you suggested eliminated the string vs number error
However the dimmer for white temperature control still doesn't work (as in the dimmer is set at 0% and cannot be moved)

Here is the code from the wiki

Code: Select all

 commandArray = {}
DomDevice = 'nameofyourdummyselectorsetasdimmer';
IP = 'youryeelightip';
PORT = '55443'
 
if devicechanged[DomDevice] then
   if(devicechanged[DomDevice]=='Off') then 
     DomValue = 0;
     runcommandoff = "sudo echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";;
     os.execute(runcommandoff);
   else
     DomValue = otherdevices_svalues[DomDevice];   
   CalcValue = ((DomValue-1) * 48)+1700;
   end
   if CalcValue==nil then CalcValue=0 end
     runcommand = " sudo echo -ne '{\"id\":1, \"method\":\"set_scene\",\"params\":[\"ct\"," .. CalcValue .. ", 75]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
   os.execute(runcommand);
   print(runcommand)
   print("Color Temp= "..CalcValue);
end
return commandArray 
(have obviously changed the DomDevice Name and bulb IP)

Any idea what could be wrong

airmarshall
Posts: 15
Joined: Friday 04 August 2017 19:21
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by airmarshall » Friday 04 August 2017 19:26

superczar wrote:@westcott - Making the change you suggested eliminated the string vs number error
However the dimmer for white temperature control still doesn't work (as in the dimmer is set at 0% and cannot be moved)

Here is the code from the wiki

Code: Select all

 commandArray = {}
DomDevice = 'nameofyourdummyselectorsetasdimmer';
IP = 'youryeelightip';
PORT = '55443'
 
if devicechanged[DomDevice] then
   if(devicechanged[DomDevice]=='Off') then 
     DomValue = 0;
     runcommandoff = "sudo echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";;
     os.execute(runcommandoff);
   else
     DomValue = otherdevices_svalues[DomDevice];   
   CalcValue = ((DomValue-1) * 48)+1700;
   end
   if CalcValue==nil then CalcValue=0 end
     runcommand = " sudo echo -ne '{\"id\":1, \"method\":\"set_scene\",\"params\":[\"ct\"," .. CalcValue .. ", 75]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
   os.execute(runcommand);
   print(runcommand)
   print("Color Temp= "..CalcValue);
end
return commandArray 
(have obviously changed the DomDevice Name and bulb IP)

Any idea what could be wrong
Domoticz does not support dimming for X10 switches.
Create a switch from the hardware/dummy page, edit this switch, make it a dimmer

This allowed me to add a working dimmer slider, however I'm still having an issue setting the "TempValue", still researching but will post back here if I need my own help (which is likely, as I'm an idiot!)

airmarshall
Posts: 15
Joined: Friday 04 August 2017 19:21
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by airmarshall » Saturday 05 August 2017 23:43

If it's of use to anyone I managed to fix my issue, which was eventually everything seemingly working with the wiki scripts yet nothing actually happening on the bulb.

I had to remove 'sudo' from the commands, hence:

Code: Select all

runcommandoff = "echo -ne '{\"id\":1,\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";;
Probably OS specific, I'm running domoticz through a docker on an unraid server.

IS there anyway I can check/test the polling is working? If I switch the light off with the Temp Slider switch OR the Dimmer Switch, the other switch and the RGB Switch never update to being OFF etc....??

Ariz
Posts: 3
Joined: Wednesday 13 September 2017 5:42
Target OS: OS X
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by Ariz » Thursday 21 September 2017 6:15

Have you set on the lamp app developer mode?

Inviato da Tapatalk



gclub

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests