hass-emulated-hue / core

Hue Emulation for Home Assistant
Apache License 2.0
318 stars 55 forks source link

Add advertise ip #533

Closed eloo closed 5 months ago

eloo commented 5 months ago

Hi,

this PR enables the emulated hue to use a custom ip for advertisement together with some fixed for the custom port configuration.

My main goal for this changes is to use the emulated hue in kubernetes together with metallb.

Addresses the following issue: https://github.com/hass-emulated-hue/core/issues/513 https://github.com/hass-emulated-hue/core/issues/514

Example of my config using the "app-template" helm chart (https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template)


controllers:
  ...
  hass-emulated-hue:
    enabled: true
    pod:
      hostNetwork: true   # needed for upnp and zeroconf
      affinity: 
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: node-role.kubernetes.io/control-plane
                operator: DoesNotExist
    containers:
      main:
        env: 
          HASS_URL: h****
          HTTP_PORT: 6547
          HTTPS_PORT: 6548
          VERBOSE: "true"
          ADVERTISE_IP: 192.168.11.97
          USE_DEFAULT_PORTS_FOR_DISCOVERY: "true"
          DATA_DIR: /config
        envFrom:
          - secretRef:
              name: emulated-hue-secrets
        image: 
          repository: docker.io/eloo/hass-emulated-hue
          tag: 0.4.0-dev
        probes:
          liveness:
            enabled: false
          readiness:
            enabled: false
          startup:
            enabled: false
service:
  ...
  emulated-hue:
    controller: hass-emulated-hue
    enabled: true
    type: LoadBalancer
    annotations:
      metallb.universe.tf/ip-allocated-from-pool: emulated-hue-pool
    ports:
      hue-http:
        port: 80
        targetPort: 6547
      hue-https:
        port: 443
        targetPort: 6548
persistence:
  ...
  hass-emulated-hue:
    enabled: true
    type: persistentVolumeClaim
    name: hass-emulated-hue
    accessMode: ReadWriteOnce
    size: 100Mi
    storageClass: nfs-client-ssd        
    advancedMounts:
      hass-emulated-hue:
        main:
          - path: /config
alexyao2015 commented 5 months ago

There should also be changed to the docker image to expose this configuration setting through bashio as well as in the hassio repo.

eloo commented 5 months ago

Hi, as hass-emulated-hue seems to have still a lot of bugs i have switched to DIYHue which works pretty stable also in combination with Harmony Hub.

So i will close this PR as im no longer using this project.

Feel free to use my work as draft for implementation for custom advertisements.