Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtual switch is not visible #222

Open
hlyi opened this issue Jul 16, 2021 · 1 comment
Open

virtual switch is not visible #222

hlyi opened this issue Jul 16, 2021 · 1 comment

Comments

@hlyi
Copy link

hlyi commented Jul 16, 2021

I programed a device with two switches: one is a typical GPIO switch, the other is a virtual (platform) switch. esphome log shows the following:
[19:52:55][C][gpio.output:010]: GPIO Binary Output:
[19:52:55][C][gpio.output:011]: Pin: GPIO5 (Mode: OUTPUT, INVERTED)
[19:52:55][C][switch.gpio:048]: GPIO Switch 'gpio switch'
[19:52:55][C][switch.gpio:049]: Pin: GPIO12 (Mode: OUTPUT)
[19:52:55][C][switch.gpio:071]: Restore Mode: Restore (Defaults to OFF)
[19:52:55][C][template.switch:058]: Template Switch 'virtual switch'
[19:52:55][C][template.switch:059]: Restore State: NO
[19:52:55][C][template.switch:060]: Optimistic: NO

esphome-ts found the GPIO switch and is able to control it as expected. However, esphome-ts didn't "see" the virtual switch. Is this normal?

@lucavb
Copy link
Owner

lucavb commented Aug 8, 2021

Hey, you can try the code I wrote over here for homebridge-esphome-ts. https://github.com/lucavb/homebridge-esphome-ts/blob/master/src/shared/debug.ts

This roughly shows you what you can do to get the raw data that it receives. You can then upload this file here and I can maybe see somethign. Depending on how tech savvy you are, you can also try to parse this data then again yourself. You probably interested in what data you are getting for https://github.com/lucavb/esphome-ts/blob/master/src/api/requestResponseMatching.ts#L18 . But bottom line should be something like this const res = ListEntitiesSwitchResponse.decode(Uint8Array.of([/* your bytes */])); if you check out the code for esphome-ts and put the bytes you get with the homebridge-esphome-ts code in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants