update json_data and model so more than one address can be revieved from server

This commit is contained in:
Adrian Zuercher
2025-07-30 17:16:50 +02:00
parent 3704edebd5
commit 49dff4f609
6 changed files with 24 additions and 11 deletions

View File

@@ -10,8 +10,12 @@ func (d *ArtNetDriver) Publish(pubs ...json_dataModels.Publish) error {
}
for _, pub := range pubs {
if drv, ok := (d.Subscriptions)[pub.Uuid]; ok {
d.SetValue(drv.Bus, drv.Address, uint8(pub.Value.(float64)))
if subs, ok := (d.Subscriptions)[pub.Uuid]; ok {
for _, sub := range subs {
for _, address := range sub.Address {
d.SetValue(sub.Bus, address, uint8(pub.Value.(float64)))
}
}
}
}
d.SendData()

View File

@@ -14,7 +14,12 @@ func (d *ArtNetDriver) Subscribe(subs ...json_dataModels.Subscription) {
for _, sub := range subs {
if drv, ok := (*sub.Drivers)[sub.Driver]; ok {
d.Subscriptions.AddSubscription(sub.Uuid, drv)
d.SetValue(drv.Bus, drv.Address, uint8(sub.Value.(float64)))
for _, bus := range drv.Buses {
for _, address := range bus.Address {
d.SetValue(bus.Name, address, uint8(sub.Value.(float64)))
}
}
}
}
d.SendData()