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

Ebusd integration #16899

Closed
wants to merge 21 commits into from
Closed

Ebusd integration #16899

wants to merge 21 commits into from

Conversation

CrazYoshi
Copy link
Contributor

@CrazYoshi CrazYoshi commented Sep 26, 2018

Description:

Integration between ebusd (https://github.com/john30/ebusd), daemon for communication with eBUS heating systems, and homeassistant using sensor component.

Example entry for configuration.yaml:

ebus:
  - platform: ebusd
    host: 127.0.0.1
    port: 8888
    name: 'ebusd'
    circuit: '700'
    monitored_conditions:
      - 'MaxFlowTemperatureDesired'
      - 'MinFlowTemperatureDesired'
      - 'WaterPressure'
      - 'PumpStatus'
      - 'HWTemperatureDesired'
      - 'HWTimerMonday'
      - 'HWTimerTuesday'
      - 'HWTimerWednesday'
      - 'HWTimerThursday'
      - 'HWTimerFriday'
      - 'HWTimerSaturday'
      - 'HWTimerSunday'
      - 'Zone1NightTemperature'
      - 'Zone1DayTemperature'
      - 'Zone1RoomTemperature'
      - 'Zone1ActualRoomTemperatureDesired'
      - 'Zone1TimerMonday'
      - 'Zone1TimerTuesday'
      - 'Zone1TimerWednesday'
      - 'Zone1TimerThursday'
      - 'Zone1TimerFriday'
      - 'Zone1TimerSaturday'
      - 'Zone1TimerSunday'
      - 'Zone1OperativeMode'
      - 'PowerEnergyConsumptionThisMonth'

Integration between ebusd (https://github.com/john30/ebusd), daemon for communication with eBUS heating systems, and homeassistant using sensor component.
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
update requirements_all
Solve: "Class 'EbusdData' inherits from object, can be safely removed from bases"
hund string length fixes
Copy link
Member

@cgarwood cgarwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests will need added for the component as well.

homeassistant/components/sensor/ebusd.py Outdated Show resolved Hide resolved
CONF_MONITORED_VARIABLES changed to CONF_MONITORED_CONDITIONS
coveragerc updated
@frenck
Copy link
Member

frenck commented Sep 30, 2018

Could not find a related documentation PR, therefore added the label docs-missing.

@CrazYoshi
Copy link
Contributor Author

CrazYoshi commented Oct 1, 2018

Could not find a related documentation PR, therefore added the label docs-missing.

Pull request submitted to add documentation to home-assistant.io https://github.com/home-assistant/home-assistant.io/pull/6412

.coveragerc Outdated Show resolved Hide resolved
@dkuschmierz
Copy link

Hi,

i tried to add your component as a custom component and the configuration seems ok so far (at least the check says so). I followed your description, but i do not see any values in the dashboard. How do i add them?

@Dinth
Copy link

Dinth commented Oct 2, 2018

i tried to add your component as a custom component and the configuration seems ok so far (at least the check says so). I followed your description, but i do not see any values in the dashboard. How do i add them?

Is your ebus daemon running and are you sure that you're fetching variables which are supported by your hardware?

@dkuschmierz
Copy link

dkuschmierz commented Oct 2, 2018

i tried to add your component as a custom component and the configuration seems ok so far (at least the check says so). I followed your description, but i do not see any values in the dashboard. How do i add them?

Is your ebus daemon running and are you sure that you're fetching variables which are supported by your hardware?

Yes, my ebus daemon is running and i can read the desired value. Unfortunately it was not in the config, so I added the following line:

'HwcTemperature':
['HwcTemp', '°C', 'mdi:thermometer', 0],

@dkuschmierz
Copy link

And the config looks like that:

Weather prediction

sensor:

  • platform: yr

#ebusd

  • platform: ebusd
    host: 127.0.0.1
    port: 8888
    name: 'ebusd'
    circuit: 'ehp'
    monitored_variables:
    • 'HwcTemperature'

CONF_MONITORED_VARIABLES restored, raise PlatformNotReady exception and guard clause added on update()
Added HWTemperature to configurable variables
@CrazYoshi
Copy link
Contributor Author

CrazYoshi commented Oct 2, 2018

And the config looks like that:
#ebusd

  • platform: ebusd
    host: 127.0.0.1
    port: 8888
    name: 'ebusd'
    circuit: 'ehp'
    monitored_variables:

    • 'HwcTemperature'

I have added HWTemperature to monitored_conditions.

revert to CONF_MONITORED_CONDITIONS
homeassistant/components/ebus/const.py Outdated Show resolved Hide resolved
homeassistant/components/ebus/const.py Outdated Show resolved Hide resolved
homeassistant/components/ebus/const.py Show resolved Hide resolved
homeassistant/components/ebus/const.py Outdated Show resolved Hide resolved
homeassistant/components/ebus/const.py Outdated Show resolved Hide resolved
@CrazYoshi
Copy link
Contributor Author

'OutsideTemp': ['OutsideTemp', 'C', 'mdi:thermometer',4]

I believe it would be better to have this merged to the main branch asap and once it's merged we can focus on adding more variables/features and i will be happy to commit some myself. There's no point of adding new variables now, as every device has an unique set and all together there are probably thousands of different variables out there
ebusctl find -r | wc -l
163

elif self._type == 4: self._valTemp, self._stateTemp = self.data.value[self._name].split(";") if "ok" in self._stateTemp: self._state = format(float(self._valTemp),'.1f')

Same here, this should be added in the future as "$temp; ok" value is correct - that's what the boiler returns, status can be split using template sensor and last but not least - formatting return values to look nice on every device will be very time consuming.

I have now change the code in order to have in const.py sensor types splitted by circuit and I also create the type 4 for value;status return values

Access to a protected member fix
@CrazYoshi
Copy link
Contributor Author

Is it everthing fine with my component? When it will be merged on master?

@dkuschmierz
Copy link

Can you please explain how the different values are updated? At the moment i have approx. 20 values I read from my heatpump, but it seems that the values are read in serial and not in parallel. Is this correct? My wish is, that I can read values in parallel with different query cycles. For example, i will read the outside-temperature every 2 minutes, but the circulation pump every 5s to check if it is running. Is this anyhow possible?

@CrazYoshi
Copy link
Contributor Author

Can you please explain how the different values are updated? At the moment i have approx. 20 values I read from my heatpump, but it seems that the values are read in serial and not in parallel. Is this correct? My wish is, that I can read values in parallel with different query cycles. For example, i will read the outside-temperature every 2 minutes, but the circulation pump every 5s to check if it is running. Is this anyhow possible?

No, this is not possible cause if you already open a socket connection if you open another one in parallel it will receive an error cause socket cannot manage more than one connection open at time.

@dkuschmierz
Copy link

Can you please explain how the different values are updated? At the moment i have approx. 20 values I read from my heatpump, but it seems that the values are read in serial and not in parallel. Is this correct? My wish is, that I can read values in parallel with different query cycles. For example, i will read the outside-temperature every 2 minutes, but the circulation pump every 5s to check if it is running. Is this anyhow possible?

No, this is not possible cause if you already open a socket connection if you open another one in parallel it will receive an error cause socket cannot manage more than one connection open at time.

But what is exactly the MINIMUM_TIME_BETWEEN_UPDATE parameter? Is this the time which is waited between Sensor_A_Value and Sensor_B_Value or is this the time between Sensor_A_Value and Sensor_A_Value2? And if it is the time between to different sensor values, are they read in serial or random?

@CrazYoshi
Copy link
Contributor Author

Can you please explain how the different values are updated? At the moment i have approx. 20 values I read from my heatpump, but it seems that the values are read in serial and not in parallel. Is this correct? My wish is, that I can read values in parallel with different query cycles. For example, i will read the outside-temperature every 2 minutes, but the circulation pump every 5s to check if it is running. Is this anyhow possible?

No, this is not possible cause if you already open a socket connection if you open another one in parallel it will receive an error cause socket cannot manage more than one connection open at time.

But what is exactly the MINIMUM_TIME_BETWEEN_UPDATE parameter? Is this the time which is waited between Sensor_A_Value and Sensor_B_Value or is this the time between Sensor_A_Value and Sensor_A_Value2? And if it is the time between to different sensor values, are they read in serial or random?

That is the time between the refresh for the same sensor.

@dkuschmierz
Copy link

Ok, but then i would expect that i will see all sensor-values after this time if i restart the system. But for some values it takes up to 5 minutes until I see the first value...

@Dinth
Copy link

Dinth commented Oct 16, 2018

Ok, but then i would expect that i will see all sensor-values after this time if i restart the system. But for some values it takes up to 5 minutes until I see the first value...

It may depend on how often your boiler broadcasts the value. AFAIK with eBus protocol devices (boilers, etc) periodically broadcast variables on their own. Maybe it's possible to query the device (im not sure about this) specifically for a particular variable, but during normal usage the boiler just periodically broadcasts values and eBusd picks them up.
Can you ssh to your eBusd server and try running ebusctl read to check if the value has been broadcasted by the boiler?

@dkuschmierz
Copy link

dkuschmierz commented Oct 16, 2018 via email

@CrazYoshi
Copy link
Contributor Author

I think that it’s more a home-assistant problem. The value I’m observing is not a brodcasted, it’s a queried one. Even if I query the value with ebusctl the value is not updated in homeassistant..

Am 16.10.2018 um 16:38 schrieb Michal @.***>: Ok, but then i would expect that i will see all sensor-values after this time if i restart the system. But for some values it takes up to 5 minutes until I see the first value... It may depend on how often your boiler broadcasts the value. AFAIK with eBus protocol devices (boilers, etc) periodically broadcast variables on their own. Maybe it's possible to query the device (im not sure about this) specifically for a particular variable, but during normal usage the boiler just periodically broadcasts values and eBusd picks them up. Can you ssh to your eBusd server and try running ebusctl read to check if the value has been broadcasted by the boiler? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

So I think is not an home-assistant issue too cause ebusctl open a socket connection as my component do

@Dinth
Copy link

Dinth commented Oct 16, 2018

I think that it’s more a home-assistant problem. The value I’m observing is not a brodcasted, it’s a queried one. Even if I query the value with ebusctl the value is not updated in homeassistant..

It's really hard to tell without further investigation. This sensor doesnt speak with the device directly, but through an external daemon/server.
Boiler <-> ebusd "receiver" <-> ebusd server <-> home assistant component
The best wait to check where's the problem would be to query a value simulatenously on both ebusd server and Home Assistant.

The value I’m observing is not a brodcasted, it’s a queried one.

Correct me if im wrong - but its only possible to "query" a value by running ebusctl read command manually, otherwise you're just relying on values broadcasted by the device.

@dkuschmierz
Copy link

dkuschmierz commented Oct 16, 2018 via email

@CrazYoshi
Copy link
Contributor Author

Ok, but what happens if two components try to connect at the same time? Is one blocked? And if yes, how often does it try to reconnect?

Am 16.10.2018 um 16:59 schrieb CrazYoshi @.>: I think that it’s more a home-assistant problem. The value I’m observing is not a brodcasted, it’s a queried one. Even if I query the value with ebusctl the value is not updated in homeassistant.. … Am 16.10.2018 um 16:38 schrieb Michal @.>: Ok, but then i would expect that i will see all sensor-values after this time if i restart the system. But for some values it takes up to 5 minutes until I see the first value... It may depend on how often your boiler broadcasts the value. AFAIK with eBus protocol devices (boilers, etc) periodically broadcast variables on their own. Maybe it's possible to query the device (im not sure about this) specifically for a particular variable, but during normal usage the boiler just periodically broadcasts values and eBusd picks them up. Can you ssh to your eBusd server and try running ebusctl read to check if the value has been broadcasted by the boiler? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread. So I think is not an home-assistant issue too cause ebusctl open a socket connection as my component do — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

I think home-assistant components runs async. Anyway this is not the place to discuss about it, so please only update if you have suggestion or issues with this component.

@dkuschmierz
Copy link

I set the MINIMUM_TIME... to 5 seconds and for example for the CompPressLow i get the following timestamps in the log:

2018-10-16 14:01:25 DEBUG (Thread-6) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:06:00 DEBUG (Thread-20) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:06:55 DEBUG (Thread-21) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:08:34 DEBUG (Thread-14) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow

As you can see, the time between the queries is very random. Sorry for discussing this topic here, but whereelse can we do it?

@CrazYoshi
Copy link
Contributor Author

I set the MINIMUM_TIME... to 5 seconds and for example for the CompPressLow i get the following timestamps in the log:

2018-10-16 14:01:25 DEBUG (Thread-6) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:06:00 DEBUG (Thread-20) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:06:55 DEBUG (Thread-21) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow
2018-10-16 14:08:34 DEBUG (Thread-14) [custom_components.ebus.ebusd] Opening socket to ebusd CompPressLow: read -m 0 -c ehp -f CompPressLow

As you can see, the time between the queries is very random. Sorry for discussing this topic here, but whereelse can we do it?

You cannot have different timing for each monitored_variables and it is not possible to trigger them all every 5 seconds. I think there is no way to achieve what you want using a single component.

_LOGGER.error()


class Ebusd(Entity):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding a sensor entity to a ebus component platform? Shouldn't this be a sensor component platform?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the author tried to pull this as a sensor before, but @balloob has rejected that PR asking CrazYoshi to rewrite this as a component.
Also there's a huge potential for this component to grow in the future, right now it's mostly reading sensor values, but in the future it may also get binary sensors, switches, or even thermostat functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly, if you scroll up you can see the change requested by him. That's the reason why I start a new component. Ebus is a generic container where also other component using the same standard can be put inside.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even though you have a component, you can still have the sensor be defined in sensor/ebusd.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what should I do to this component again? I didn't get
Can you give me some suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component manages connection and hosts services, sensor platform of ebusd will show some info as a sensor entity.

@dkuschmierz
Copy link

dkuschmierz commented Oct 20, 2018 via email

@MartinHjelmare
Copy link
Member

If no existing actuator components, switch, light, etc, fit the writable parameters we should probably just implement those as services in the ebus component. Move read parameters to a sensor component platform.

@CrazYoshi
Copy link
Contributor Author

If no existing actuator components, switch, light, etc, fit the writable parameters we should probably just implement those as services in the ebus component. Move read parameters to a sensor component platform.

I don't really agree with this aproach. I have created the ebus component cause I cannot have a service inside a sensor component. Split information read fron ebus and command always on the same device does not make really sense in my opinion.

add automatic state
elif self._type == 1:
self._state = timer_format(self.data.value[self._name])
elif self._type == 2:
if self.data.value[self._name] == 1:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add the recognition of such a value as 'on' or self.data.value[self._name] == 'on' , , because frequent are just such answers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is the STATE_ON for that. In this way it will use also translation

@dkuschmierz
Copy link

Hi @CrazYoshi

would it be possible to move from MIN_TIME_INTERVALL to SCAN_INTERVAL, so we would be able to define different ebusd platforms with different SCAN_INTERVALS. I tried to implement this, but didn't get it work...

@balloob
Copy link
Member

balloob commented Dec 14, 2018

This PR seems to have gone stale. Closing it.

@balloob balloob closed this Dec 14, 2018
@ghost ghost removed the in progress label Dec 14, 2018
@CrazYoshi CrazYoshi mentioned this pull request Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants