Aohzan / ecodevices

Home Assistant custom component for GCE Eco-Devices
Apache License 2.0
14 stars 4 forks source link

Some suggestions of improvements #9

Closed BmdOnline closed 3 years ago

BmdOnline commented 3 years ago

Hi, Starting with version 2.1.0, we have a lot of informations grabbed by the ecodevices component. I'm a newbie with HomeAssistant, so I don't know if ideas below are realistic.

Maybe you can add option to specify (when using Teleinformation), if we are using BASE, or HPHC, or Tempo (or detect it using OPTARIF). Another option for Mono or Triphase. This would reduce the data displayed unnecessarily.

Another suggestions would be to provide automation according to HP/HC changes, to Normal/Pointes (tempo).

If it is possible, an event could be triggered when a specific power is raised or exceeded.

In fact, we can do a lot of stuff now... Just imagine them.

Tell me what you thing about these suggestions. Which is realistic or not.

Thanks.

Aohzan commented 3 years ago

When I saw all the new values provided by the url you gave me, I asked myself those questions so we can discuss of it:

Maybe you can add option to specify (when using Teleinformation), if we are using BASE, or HPHC, or Tempo (or detect it using OPTARIF). Another option for Mono or Triphase. This would reduce the data displayed unnecessarily.

I'm not aware of all you need when you use HPHC, Tempo or Triphase, so I'll need help if we want to make this better. But, like it's the same request, it's the same price to get all information, so maybe the best solution if to use a template to get attributes as a sensor : https://www.home-assistant.io/integrations/template/#configuration

Another suggestions would be to provide automation according to HP/HC changes, to Normal/Pointes (tempo).

If it is possible, an event could be triggered when a specific power is raised or exceeded.

In Home-Assistant, the way to do it is to use automation, not integration by itself

In fact, we can do a lot of stuff now... Just imagine them.

Yes indeed, I try on integrate this component as part of Home-Assistant : https://github.com/home-assistant/core/pull/45499 So trying to keep it stable for now since I do it for the ipx800 integration too, but we can still add features.

I was thinking about generate hourly, daily and other statistics, but once again, we should use https://www.home-assistant.io/integrations/statistics/ instead, so I'm currently trying some stuff, that we can integrate to the README

BmdOnline commented 3 years ago

I'm not aware of all you need when you use HPHC, Tempo or Triphase, so I'll need help if we want to make this better.

I can try to help you, but I'm not aware of all specifications. For Teleinformation specifications, you can check this https://www.enedis.fr/sites/default/files/Enedis-NOI-CPT_54E.pdf and this https://www.enedis.fr/sites/default/files/Enedis-NOI-CPT_02E.pdf

But, like it's the same request, it's the same price to get all information, so maybe the best solution if to use a template to get attributes as a sensor : https://www.home-assistant.io/integrations/template/#configuration

Maybe you're right.

Another suggestions would be to provide automation according to HP/HC changes, to Normal/Pointes (tempo). If it is possible, an event could be triggered when a specific power is raised or exceeded.

In Home-Assistant, the way to do it is to use automation, not integration by itself

Other devices I use exposes several entities and several trigger for automation. For example, a weather sensor exposes temperature, humidity, pressure, wind speed... and we can create automation according to pressure change, temperature change... Another example is using kodi media player, we can trigger an automation when media player is turned on, off, paused, playing... In our case, we can trigger an automation on power change only. I have a standard BASE subscription (without HP/HC), but I think it may be a good feature to expose current state (HP vs HC...) for automation.

Maybe, instead of exposing only power consumption you can create several entities like power, intensity, current index, type heures, demain... I don't know which items may be a new entity and which ones may be additional data only.

If I can, I will try to do this and try to allow more automation

I was thinking about generate hourly, daily and other statistics, but once again, we should use https://www.home-assistant.io/integrations/statistics/ instead.

I'll have a look.

Aohzan commented 3 years ago

You can trigger from an attribute now : https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger

Maybe I can add checkboxes like : "Add HPHC entity", "Add Tempo entity" and "Add Triphase entities" to add dedicated entites when the user want.

BmdOnline commented 3 years ago

You can trigger from an attribute now : https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger

You're right, trigger with attributes works !

I'm currently trying some stuff, that we can integrate to the README

Yes, you can give some examples for automation :

Maybe I can add checkboxes like : "Add HPHC entity", "Add Tempo entity" and "Add Triphase entities" to add dedicated entites when the user want.

Finally, you don't have to change anything, since we can really automate everything as it is.

I was thinking about generate hourly, daily and other statistics, but once again, we should use https://www.home-assistant.io/integrations/statistics/ instead,

For now, I'm not really satisfied with hass statistics and history. I have to work on the subject.

One last thing (maybe related to pyecodevices). You're reporting some numeric values as numeric, and other as string :

type_heures: TH..
souscription: '30'
intensite_max: 090
intensite_max_ph1: '0'
intensite_max_ph2: '0'
intensite_max_ph3: '0'
intensite_now: '005'
intensite_now_ph1: '0'
intensite_now_ph2: '0'
intensite_now_ph3: '0'
numero_compteur: 012345678901 (number changed for privacy)
option_tarifaire: BASE
index_base: 012345678 (number changed for privacy)
index_heures_creuses: '0'
index_heures_pleines: '0'
index_heures_normales: '0'
index_heures_pointes: '0'
preavis_heures_pointes: '0'
groupe_horaire: A
etat: '000000'
unit_of_measurement: VA
friendly_name: Compteur Linky
icon: 'mdi:flash'
device_class: power
Aohzan commented 3 years ago

One last thing (maybe related to pyecodevices). You're reporting some numeric values as numeric, and other as string :

Indeed, but i'm not sure it's a good idea to force type, because I don't control what is send by the ecodevices/teleinfo and I probably get errors. Maybe it's better to cast in Home Assistant like: "{{ state_attr('sensor.teleinfo','intensite_now') | int }}" ?

BmdOnline commented 3 years ago

Hi, I did some real tests. It works without type cast.

trigger:
  - platform: numeric_state
    entity_id: sensor.teleinfo_1
    attribute: intensite_now
    above: '3'

And it works using value_template and type cast :

alias: Attribute automation
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.teleinfo_1
    value_template: '{{ state_attr(''sensor.teleinfo_1'', ''intensite_now'') | int }}'
    above: '3'

Or

trigger:
  - platform: numeric_state
    entity_id: sensor.teleinfo_1
    value_template: '{{ state.attributes.intensite_now | int }}'
    above: '3'

We can do anything we want, without changing anything to your libraries. So, it seems to be perfect as it.

Thanks again for you help.

Aohzan commented 3 years ago

It's an advantage of python (and sometimes a disadvantage), it's not strict on types :)