home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.82k stars 30.91k forks source link

Hydro Quebec sensors does not respect the customization friendly name #6828

Closed djfjeff closed 7 years ago

djfjeff commented 7 years ago

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.41.0

Python release (python3 --version): Python 3.4.2

Component/platform: hydroquebec

Description of problem: When setting friendly_name in customization for the hydroquebec sensor, they are ignored and the default name are shown.

Expected: Show the friendly_name

Problem-relevant configuration.yaml entries and steps to reproduce:

# customization.yaml
    sensor.hydroquebec_period_mean_daily_bill:
      friendly_name: Daily Bill
    sensor.hydroquebec_period_total_bill:
      friendly_name: Total Bill
    sensor.hydroquebec_period_mean_daily_consumption:
      friendly_name: Daily Consumption
    sensor.hydroquebec_period_total_consumption:
      friendly_name: Total Consumption
    sensor.hydroquebec_period_length:
      friendly_name: Current Days
    sensor.hydroquebec_period_total_days:
      friendly_name: Total Days
    sensor.hydroquebec_period_higher_price_consumption:
      hidden: true
    sensor.hydroquebec_period_lower_price_consumption:
      hidden: true
    sensor.hydroquebec_yesterday_higher_price_consumption:
      hidden: true
    sensor.hydroquebec_yesterday_lower_price_consumption:
      hidden: true
  1. Enable the hydroquebec sensors
  2. Set friendly_name in customization
  3. See the old default name

Additional info: So, instead of seeing "Daily Bill", I still see "HydroQuebec Period daily average bill"

djfjeff commented 7 years ago

@titilambert I know you maintain the hydroquebec sensor so I thought about notifying you.

titilambert commented 7 years ago

@djfjeff could you try to comment this line: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/hydroquebec.py#L122 and retry ? I guess, that should be good.

djfjeff commented 7 years ago

@titilambert No, it didn't work, the sensor disappeared from my web interface but with no error in the log.

titilambert commented 7 years ago

@djfjeff this is strange, could check in the dev state page if you have this sensor: sensor.hydro_yesterday_total_consumption ?

djfjeff commented 7 years ago

@titilambert Without your change, I have sensor.hydroquebec_yesterday_total_consumption present and the data show in my web interface (note that I don't have the key you specified : sensor.hydro_yesterday_total_consumption).

With the change at line 122, the key is still present in dev state but no data show in my interface. Also, in the dev state, the key still report as : friendly_name: HydroQuebec Yesterday total consumption

titilambert commented 7 years ago

@djfjeff could you try to add a name attribute to the hydroquebec sensor ?

titilambert commented 7 years ago

@djfjeff I just tested on my own installation, with the commented line and with the name attribute, and it's working

djfjeff commented 7 years ago

@titilambert I found why it was not showing when I commented the line. Commenting the line change the name of the key. For example, before commenting the line, one key was named "sensor.hydroquebec_period_total_bill" and after commenting the line, it was now named "sensor.hydroquebec_current_period_bill"...

Same goes for other keys, I don't understand why it happen.

djfjeff commented 7 years ago

@titilambert Just did another test, just adding a name attribute to my sensor fix the customized name issue for me. I didn't have to comment the line in the file. Maybe a fix in the documentation to specify this?

Thanks for your help tracking this!

titilambert commented 7 years ago

That's strange. Could you make a test, without the name, with the line commented ? that should be work. This line is not really a good idea ... I will delete it if it's working

djfjeff commented 7 years ago

@titilambert It works but I needed to change all my key lsike I said in my previous message. For example, "sensor.hydroquebec_period_total_bill" became "sensor.hydroquebec_current_period_bill". After that, everything works fine.

titilambert commented 7 years ago

@djfjeff ok, perfect, I have to change it, because it's not normal to override the entity_id.

balloobbot commented 7 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 7 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍