Bepacom-Raalte / Bepacom-BACnet-IP-Integration

Bepacom BACnet Integration Repository
Apache License 2.0
12 stars 2 forks source link

Wrong presentValue is send in entity (select) #9

Closed selfstream closed 7 months ago

selfstream commented 7 months ago

Sorry i'm new to HA so i hope i explain it right. The AddOn and the Integration is running but i can't right control the device by a "select"-entity

For example: I have activated a select-entity with 4 options.

select.corrigoventilation_airunitautomode

options: OFF, Manual On reduced speed, Manual On normal speed, AUTO OutOfService: 0 EventState: normal icon: mdi:fan friendly_name: Lueftung Halle

When i select the first option "OFF" it sends a presentValue=2 to the api. But it should be presentValue=1 The second option sends presentValue=3 - it should be presentValue=2 The third option sends presentValue=4 - it should be presentValue=3 and so on

I have the same problems with other entities with multistates i activated in the integration.

Can you reproduce this?


s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: Bepacom EcoPanel BACnet/IP Interface Bepacom BACnet/IP interface for the Bepacom EcoPanel. Allows BACnet devices to be available to Home Assistant through an API

Add-on version: 1.1.3 You are running the latest version of this add-on. System: Home Assistant OS 11.1 (aarch64 / raspberrypi3-64) Home Assistant Core: 2023.11.2 Home Assistant Supervisor: 2023.11.3

Bepacom-Raalte commented 7 months ago

Is it the same with all multistates?

If so, go to the const.py file in the integration folder within custom_components. In here, change STATETEXT_OFFSET = 1 to STATETEXT_OFFSET = 0. Then restart the integration or Home Assistant.

Hopefully it should be alright then! Let me know the results please.

selfstream commented 7 months ago

Thank you very much - that helps and i can control it right - the right presentValue is sent.

But now i see the wrong status in all select entities. Wenn i click on the first option "Off" i see the next option "Manual on, reduced speed" screen All entities now have this offset +1

Bepacom-Raalte commented 7 months ago

Allright, so I think I see the problem. You can set the offset back to 1, and then I need you to change a little bit in the code. Please navigate to the select.py file and edit the following part:

@property def current_option(self) -> str: return ( self.coordinator.data.devices[self.deviceid] .objects[self.objectid] .stateText[ self.coordinator.data.devices[self.deviceid] .objects[self.objectid] .presentValue - STATETEXT_OFFSET #JCO ] )

And remove the - STATETEXT_OFFSET #JCO part. I think this should solve the issues. If it works, I'll push an update for you.

selfstream commented 7 months ago

I have played around with the offsets and now it works for me:

in the const.py file i have:

STATETEXT_OFFSET = 0
STATETEXT_OFFSET1 = 1

and the new variable STATETEXT_OFFSET1 i used in the select.py file

@property def current_option(self) -> str: return ( self.coordinator.data.devices[self.deviceid] .objects[self.objectid] .stateText[ self.coordinator.data.devices[self.deviceid] .objects[self.objectid] .presentValue - STATETEXT_OFFSET1] )

Thank you for your help and your great work!

Bepacom-Raalte commented 7 months ago

Glad it works now! Just a quick question, was it only an issue with Multi State Value objects? or also Multi State Outputs?

selfstream commented 7 months ago

I think in my case Multi States Outputs are integrated as Multi States Value Objekts, too. But i have to test it.

Bepacom-Raalte commented 7 months ago

If you don't mind, could you test the new version and verify if it works for you as well?

selfstream commented 7 months ago

Thank you for the new version! I have tested it and it works good for me!

just as a reference for you: As I have already written, for me all multi-state outputs are also multi-state values. If I try to change these, I first have to restart the add-on otherwise I can't control anything anymore.