Open Taomyn opened 3 months ago
Hey there @jpbede, mind taking a look at this issue as it has been labeled with an integration (trend
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
trend documentation trend source (message by IssueLinks)
Disappointed that this isn't being looked at, especially for a new feature as there must have been support to get it added - why would monetary values not be something to watch the trend of, considering we're able to monitor all sorts of consumption by our smart homes.
The trend sensor works independently of any device class. It just considers the state or a attribute. How does the configuration of your trend sensor look like?
Not sure the best way to show, but is this enough:
The attributes available don't show one for the value which is why it's value shows empty when I try to display it:
The entity I am monitoring is:
Which I can display:
This month's update allowed me to set the "state_class" to "measurement" which seemed the best option to use, but it still does not show me the main attribute of the entity i.e. the actual value.
The YAML to create the entity is:
sensor:
- unique_id: guichet_95_fuel_price
device_class: monetary
state_class: measurement
name: 95 Fuel Price
icon: mdi:gas-station
value_template: "{{ value_json['items'][0]['Price95Fuel'] }}"
unit_of_measurement: "€"
Just leave the attribute field empty, it will then use the state value, additionally you would need to set a minimum gradient.
Please read https://www.home-assistant.io/integrations/trend#using-multiple-samples how to set and calculate the minimum gradient.
I appreciate the help but I don't think I'm fully getting this, sorry. Don't know if this helps explain what I'm after, but this sensor checks for the current value every 4 hours, but it could be days/weeks before it ever changes. I was hoping that "trend" would simply tell me that the current value is either an increase or a decrease of the previous change regardless of when that was. So if last month the value went up but has remained the same since, it continues to show as an increase.
I understand what you want, but the trend integration needs to know when it's an increase/decrease, that's what the gradient is for. The gradient tells us how much the source sensor needs to deviate between samples to trigger.
I'm thinking about of simplifying this integration, but I don't know when I've time to do this
The problem
I have a sensor that is device_class "monetary", which I can add as new trend helper, but it will not allow me to choose the sensor's value for the trend helper to monitor. The helper simply stays as "unknown".
I'm not sure if it's caused by this, but I cannot edit the trend to change the value it monitors, there does not seem to be a field showing it, only the name of the trend sensor.
What version of Home Assistant Core has the issue?
core-2024.7.0 to core-2024.7.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Trend
Link to integration documentation on our website
https://www.home-assistant.io/integrations/trend
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response