rrooggiieerr / esphome-livingcolors1

Philips LivingColors 1st generation component for ESPHome.
Other
8 stars 1 forks source link

How to find the adresses #2

Open PvdGulik opened 7 months ago

PvdGulik commented 7 months ago

Hello, really nice that you got the LivingColors gen 1 working again in 2023, with a esp8266.

I followed you instructions, but could not find how to find the adress of the lights. I also tried to install the ino file with Arduino to find the adresses. Unfortunatly I ended in a compile error, which I cannot solve:

/Users/******/Downloads/Philips-Living-Colors-Gen1-with-NodeMCU-master/philipslivingcolor/PhilipsLampLib.cpp: In member function 'bool PhilipsLampLib::addLamp(uint8_t*)':
/Users/******/Downloads/Philips-Living-Colors-Gen1-with-NodeMCU-master/philipslivingcolor/PhilipsLampLib.cpp:244:11: error: control reaches end of non-void function [-Werror=return-type]
  244 |     debug ("Adressspeicer voll!");
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors

exit status 1

Compilation error: control reaches end of non-void function [-Werror=return-type]

So how to find the address of the lights, for address: 0x... in your code:

light:
  - platform: livingcolors1
    name: "LivingColors"
    address: 0x...

Thanks!

rrooggiieerr commented 7 months ago

Hi @PvdGulik, thanks for trying out my LivingColors component.

I'm using an ESP32 myself, although I expect it should also work on an ESP8266.

There's no function to read the remote address in my code yet, its on my todo, but since I've got my own light working there's not a high demand for myself and thus not a high priority. When I've got time I still like to implement it though.

I used the ino file you mentioned to get the remote id, so if you fix why it doesn't compile for you you can do the same.

Also read this issue which asks the same: https://github.com/rrooggiieerr/esphome-livingcolors1/issues/1

rrooggiieerr commented 7 months ago

You need to add return false; after debug ("Adressspeicer voll!"); in PhilipsLampLib.cpp

thus:

    // Hier angekommen, keine Platz mehr für neue Adressen!
    debug("Adressspeicer voll!");
    return false;
}
PvdGulik commented 7 months ago

Thanks, that helped a lot, strange it was lost in the orginal...

So I loaded the ino file, and started the serialmonitor in Arduino IDE. I do see this, but wonder what the adresses are. I have 2 LightingColor lamps:

Lampenadressen aus EEPROM geladen

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (28):
epc1=0x402018cc epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000002 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffe60 end: 3fffffd0 offset: 0150
3fffffb0:  feefeffe 00000000 3ffee760 40202a44  
3fffffc0:  feefeffe feefeffe 3fffdab0 40100e75  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v00043140
~ld
����N�r��n|�d�$`#��|r�l�o��n�$`��r�p��l��

Is it 0x4010f000 and 0x3fff20b8? Or could that also be my IKEA Tradfi lamps?

Thanks for you help!

Update: I tried the three adresses: 0x402018cc; 0x4010f000; 0x3fff20b8. But the lamps did not response. So I'm doing something wrong....

bn326160 commented 1 month ago

Hey, I'm having the following output from the philipplive code:

Suche Adresse: 55 46 32 28 241 156 219 10 Vorhandene Adressen im Speicher: 55 46 32 28 241 156 219 10 228 119 246 43 241 156 219 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

So I have 2 addresses (and also two lights linked to one remote) However, how do I convert them?

Removing all spaces and converting to hex results in:

that didn't work

I probably had to convert each decimal seperately, resulting in:

However, these also don't work.

What to do?

kababoom commented 1 month ago

I probably had to convert each decimal seperately, resulting in:

  • 0x372e201cf19cdba
  • 0xe477f62bf19cdba

However, these also don't work.

What to do?

Yes decimal by decimal is what worked for me..

rrooggiieerr commented 1 month ago

It should be a 16 character hex string, you're using a 15 character hex string which is by definition invalid because one byte uses 2 hex characters

kababoom commented 1 month ago

It should be a 16 character hex string, you're using a 15 character hex string which is by definition invalid because one byte uses 2 hex characters

Yes so probably your last 10 will be 0A not just A

0x372e201cf19cdb0a 0xe477f62bf19cdb0a

rrooggiieerr commented 1 month ago

@bn326160 Does it work now for you?

bn326160 commented 3 weeks ago

@rrooggiieerr Hey sorry, I was on holiday abroad! It seems to 'work' now. The lights react, however, it seems like they are reacting to a 'previous command'.

  1. Turning on - nothing
  2. Turning off - the lights turn on
  3. Set a color - the light turns off
  4. Set a different color - the light turns on and is set to the previously selected color
  5. Set a different color - the light sets to the second selected color
  6. ...

There should be a routine to double-send a command or something.

rrooggiieerr commented 3 weeks ago

@bn326160 interesting behaviour, this it totally not how it works with my LivingColors. Are you controlling the light using the ESPHome entity?

bn326160 commented 3 weeks ago

@rrooggiieerr I've only been experimenting trough the ESPHome built-in webserver for now, not trough Home Assistant yet

bn326160 commented 3 weeks ago

Update: I forked the library, uncommented the repeating sending of commands feature that you built, set the repeat # to 2 and added a delay between the transmission.

It can be used by referring to my external component

  - source:
      type: git
      url: https://github.com/bn326160/esphome-livingcolors1
      ref: 0.0.3
    components: [livingcolors1]

If you think it's a valuable addition, I can open a PR.

Works perfectly for me now, thanks for your code and support!

Kaaf76 commented 1 week ago

@rrooggiieerr Hey sorry, I was on holiday abroad! It seems to 'work' now. The lights react, however, it seems like they are reacting to a 'previous command'.

  1. Turning on - nothing
  2. Turning off - the lights turn on
  3. Set a color - the light turns off
  4. Set a different color - the light turns on and is set to the previously selected color
  5. Set a different color - the light sets to the second selected color
  6. ...

There should be a routine to double-send a command or something.

@rrooggiieerr I had the same problem when using two lamps. With one lamp it was working fine in the original code @bn326160 Your fork solved this issue.

Great work you both. I can now reuse my "old" lamps

rrooggiieerr commented 1 week ago

@Kaaf76 that is very valuable information! So let me get this clear, you're using 2 lights on one remote, and when powering both lights my version of the ESPHome component doesn't work as expected, but when powering one light it works as expected?

And if you use the remote both lights have similar behaviour? (Which I would expect it to work)

Kaaf76 commented 1 week ago

@rrooggiieerr To be complete: I use one original remote, which switch on both lamps (which probably doesn't matter). With the fork of @bn326160 it works fine now To investigate again: -I "downgraded" it to you component and the switching and changing of color changed immediately after a download, like bn326160 said. On both Lamps -I removed one lamp address ->recompiled > downloaded -> One lamp works fine!

rrooggiieerr commented 1 week ago

This actually makes it more confusing to me. I don't have 2 lights, so can't test myself. To my understanding the remote has one address which both lights listen to. The lights only listen, don't send.

Using this logic I would assume it wouldn't matter how many lights listen to the same remote.

But you're saying you're using multiple lamp. addresses which would mean the lights have a way to communicate their address to the remote? Or are you using each light with it's own remote?

What does your light configuration in ESPHome look like?

I would assume that you have two lights configured with each their own address and each controllable independently using separate light entities, OR have one address configured and both lights are controllable in sync with eachother using one light entity.

Kaaf76 commented 1 week ago

To my knowledge you program the remote to work with two lamps. Just like we do now with the ESPhome. So this doens't really matter (I recon). The whole point was to ditch the remote. I've programmed two addresses in ESPhome just like bn326169

light:
  - platform: livingcolors1
    name: "LivingColors1"
    address: 0x...
  - platform: livingcolors1
    name: "LivingColors2"
    address: 0x...

source: https://github.com/bn326160/esphome-livingcolors1

@bn326160 : You probably have the same setup with two lamps

bn326160 commented 1 week ago

@rrooggiieerr I believe it's the remote that is learning. After pressing a button on the remote, I found two addresses. I have one remote linked to two lights, but couldn't manage to unlink them, so couldn't test with only one light. But it would still be weird behavior imo.

The lights do indeed have a way to send out their address to the remote. I believe you had to hold the on button on the remote closeby to the light to 'link' them to that remote.

In ESPHome I have two lights set-up. They are indeed two separate lights, I just set them to the same setting in Apple HomeKit.