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

Home Assistant integration #53

Open
jellewie opened this issue Mar 5, 2023 · 2 comments
Open

Home Assistant integration #53

jellewie opened this issue Mar 5, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jellewie
Copy link
Owner

jellewie commented Mar 5, 2023

I want to integrate the lamp into Home Assistant, but don't know exactly how yet.

For now you can use this, where "192.168.1.255" is the IP of the lamp:

light:
  - platform: template
    lights: #https://www.home-assistant.io/integrations/light.template/
      smartclock:
        friendly_name: "Smart Clock"
        turn_on:
          service: rest_command.smartclock_on
        turn_off:
          service: rest_command.smartclock_off
        set_level:
          service: rest_command.smartclock_brightness
          data:
            brightness: "{{ brightness }}"
rest_command: #https://www.home-assistant.io/integrations/rest_command/
  smartclock_on:
    url: http://192.168.50.205/set?m=ON&r=255&g=200&b=100&s=2
    verify_ssl: false
  smartclock_off:
    url: http://192.168.50.205/set?m=clock&i=true
    verify_ssl: false
  smartclock_brightness:
    url: http://192.168.50.205/set?l={{brightness}} #https://community.home-assistant.io/t/switch-with-rest-command/154762/2
    verify_ssl: false

image

Currently, it's configured with "s=2" with means it only does the not-clock section. Remove the "&s=2" to make it change all LEDs. See

#define PreFixSection "s" //''or'0'=All, 1=TotalLEDsClock, 2=!(TotalLEDsClock)

Currently, it's set up to change the RGB with "r=255&g=200&b=100", but your own settings can be put in. no RGB support yet (HA withs with Hue/saturation and I haven't been bordered to figure that out yet.

@jellewie jellewie added enhancement New feature or request help wanted Extra attention is needed labels Mar 5, 2023
@wjtje
Copy link

wjtje commented Mar 6, 2023

Maybe the best way to integrate your own code into Home Assistant is using MQTT.

Your code can send an MQTT Discovery to Home Assistant so it will be auto discovered and configured (docs), and it can send state changes to Home Assistant.

jellewie added a commit that referenced this issue Feb 28, 2024
@jellewie
Copy link
Owner Author

Got a lot of it working in MQTT, but Still some things to fix/do

  • can byte mac[] be not-static?
  • fix setConfigurationUrl
  • when onStateCommand1(OFF), let it change back the mode. and restore AutoBrightness?
  • Update the (other) light to HA at the right moments
  • How to send RGB data to HA? the color is sometimes a mismatch
  • How to send Brightness data to HA? the Brightness is sometimes a mismatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants