dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
473 stars 116 forks source link

One physical device, need multiple HA devices each with multiple sensors #161

Open psgcooldog opened 1 year ago

psgcooldog commented 1 year ago

I'm creating an ESP32-based LORA gateway for multiple physical sensors. I already have it working as one HA "Device" with multiple sensors, but would like to have each of the physical sensors (with their multiple HA sensor entities) appear as a separate HA Device.

Although it appears that creating an HADevice with its own HAMqtt object for each top-level HA Device would work, I can't see any way to associate the HASensors with a particular top-level HADevice. It appears that the first HADevice that is created "owns" all HADevices that are created subsequently.

Can you advise if this is even possible?

Thanks for the beautiful lib!

chinswain commented 3 months ago

I have the same requirement - 10 beehives all transmitting via LoRa to a receiver which then publishes the devices to HA, having each hive as a separate HA device would be good.

psgcooldog commented 3 months ago

I hacked away at it until I made it work the way I wanted it to.

On Sun, May 19, 2024, 12:36 PM chinswain @.***> wrote:

I have the same requirement - 10 beehives all transmitting via LoRa to a receiver which then publishes the devices to HA, having each hive as a separate HA device would be good.

— Reply to this email directly, view it on GitHub https://github.com/dawidchyrzynski/arduino-home-assistant/issues/161#issuecomment-2119294792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIL33X3NDJ2TS3YWZDZIPQLZDDIH3AVCNFSM6AAAAAAW6WEEOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGI4TINZZGI . You are receiving this because you authored the thread.Message ID: @.***>

chinswain commented 3 months ago

Did you manage to add multiple devices or have you had to put them all as sensors on the one?

I've got Beehive1Temp, Beehive2Temp etc but it's really messy and lengthy code and looks a complete mess at the other end in HA with so many sensors!

psgcooldog commented 3 months ago

I sure did. I had a hard time with it, as my mind just doesn't work the way that the original author's does, lol, but I got it working to my satisfaction. I'm completely ignorant of how to properly put it out there as a fork of his project, but I'm perfectly willing to send you source if you want it.

On Mon, May 20, 2024 at 5:05 AM chinswain @.***> wrote:

Did you manage to add multiple devices or have you had to put them all as sensors on the one?

I've got Beehive1Temp, Beehive2Temp etc but it's really messy and lengthy code and looks a complete mess at the other end in HA with so many sensors!

— Reply to this email directly, view it on GitHub https://github.com/dawidchyrzynski/arduino-home-assistant/issues/161#issuecomment-2120009269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIL33X4R4C2MWGYQFETJZGTZDG4F5AVCNFSM6AAAAAAW6WEEOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRQGAYDSMRWHE . You are receiving this because you authored the thread.Message ID: @.***>

chinswain commented 3 months ago

Yea please, it would be interesting to take a look, I'm nearly at 100 sensors (which should be spread across 10 devices)

psgcooldog commented 3 months ago

Can you send me your email address, or is there some sort of messaging capability here? I haven't touched this stuff in probably 18 months or more. The best thing would be to send you the entire PlatformIO project, which includes the ESP32 gateway, and the sensor end for a Heltec CubeCell.

On Tue, May 21, 2024 at 7:26 PM chinswain @.***> wrote:

Yea please, it would be interesting to take a look, I'm nearly at 100 sensors (which should be spread across 10 devices)

— Reply to this email directly, view it on GitHub https://github.com/dawidchyrzynski/arduino-home-assistant/issues/161#issuecomment-2123587381, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIL33X6IHD3FF4IQB5QUMQDZDPJZTAVCNFSM6AAAAAAW6WEEOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGU4DOMZYGE . You are receiving this because you authored the thread.Message ID: @.***>