-
Notifications
You must be signed in to change notification settings - Fork 73
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
Use time_zone (or new param) to calculate local currency symbol #155
Comments
What is the problem with the existent? |
ah my bad. |
Yes no problem. Those lines that you posted are just there as default values but the user can change to whatever they want. |
@davidusb-geek is the "currency" homeassistant variable being passed in. Could that be used as default? |
No, currency is not being fetched from HA. It could be interesting to fetch it directly yes. |
A temporary stop gap could be another param (for addon users): web_server.py ...
params['retrieve_hass_conf']['alt'] = options['Altitude']
params['retrieve_hass_conf']['unit_of_measurement'] = options['Currency']
params['optim_conf']['set_use_battery'] = options['set_use_battery']
... utils.py ...
if 'custom_unit_load_cost_id' in runtimeparams.keys():
params['passed_data']['custom_unit_load_cost_id'] = runtimeparams['custom_unit_load_cost_id']
elif 'unit_of_measurement' in params['retrieve_hass_conf']:
params['passed_data']['custom_unit_load_cost_id']['unit_of_measurement'] = str(params['retrieve_hass_conf']['unit_of_measurement']+"/kWh")
if 'custom_unit_prod_price_id' in runtimeparams.keys():
params['passed_data']['custom_unit_prod_price_id'] = runtimeparams['custom_unit_prod_price_id']
elif 'unit_of_measurement' in params['retrieve_hass_conf']:
params['passed_data']['custom_unit_prod_price_id']['unit_of_measurement'] = str(params['retrieve_hass_conf']['unit_of_measurement']+"/kWh")
... |
To implement this, there should not be any stop gap for add-on users or any other installation method.
In my case I obtain |
So @GeoDerp do you think that it is possible to fetch the currency directly from the HA configuration? |
My current work around for this is: publish_data:
url: http://localhost:5000/action/publish-data
method: POST
content_type: "application/json"
payload: '{"custom_unit_load_cost_id": {"entity_id": "sensor.unit_load_cost", "unit_of_measurement": "$/kWh", "friendly_name": "Load Cost"}, "custom_unit_prod_price_id": {"entity_id": "sensor.unit_prod_price", "unit_of_measurement": "$/kWh", "friendly_name": "Prod Price"}}' I would welcome it automatically pulling the locale currency. |
Support for this was added on PR #399 |
emhass/src/emhass/utils.py
Lines 140 to 141 in 3dfcf1b
I could see this having multiple solutions.
currency="$"
The text was updated successfully, but these errors were encountered: