Comments (14)
https://github.com/Teslemetry/python-tesla-fleet-api/releases/tag/v0.3.1 Fixes the underlying library issue
The next release will bump and fix this issue.
from hass-teslemetry.
This should be fixed in https://github.com/Teslemetry/hacs-teslemetry/releases/tag/v1.4.2
from hass-teslemetry.
I would like to reopen this issue.. Two energy controls are still not functional:
- Allow Charging from Grid &
- Exports Allowed
Screen recording 2024-02-10 17.10.54.webm
Screen recording 2024-02-10 16.58.37.webm
from hass-teslemetry.
Some logs now to backup analysis:
Set Backup Reserve to 40%
2024-02-11 19:20:12.053 DEBUG (MainThread) [tesla_fleet_api] Sending request to api/1/energy_sites/XX/backup
2024-02-11 19:20:12.053 DEBUG (MainThread) [tesla_fleet_api] Body: {'backup_reserve_percent': 40}
2024-02-11 19:20:12.566 DEBUG (MainThread) [tesla_fleet_api] Sending request to api/1/energy_sites/XX/live_status
2024-02-11 19:20:13.316 DEBUG (MainThread) [tesla_fleet_api] Response Status: 200
2024-02-11 19:20:13.317 DEBUG (MainThread) [tesla_fleet_api] Response JSON: {'response': {'solar_power': 0, 'energy_left': 23081.210526315786, 'total_pack_energy': 40737, 'percentage_charged': 56.65908271673364, 'backup_capable': True, 'battery_power': 1070, 'load_power': 1070, 'grid_status': 'Active', 'grid_services_active': False, 'grid_power': 0, 'grid_services_power': 0, 'generator_power': 0, 'island_status': 'on_grid', 'storm_mode_active': False, 'timestamp': '2024-02-11T19:20:12+10:00', 'wall_connectors': [{'din': 'XX', 'vin': 'XX', 'wall_connector_state': 5, 'wall_connector_fault_state': 2, 'wall_connector_power': 0}, {'din': 'XX', 'vin': 'XX', 'wall_connector_state': 1, 'wall_connector_fault_state': 8, 'wall_connector_power': 451.1166}]}}
2024-02-11 19:20:13.317 DEBUG (MainThread) [custom_components.teslemetry] Finished fetching Teslemetry Energy Site Live data in 0.751 seconds (success: True)
2024-02-11 19:20:13.912 DEBUG (MainThread) [tesla_fleet_api] Response Status: 200
2024-02-11 19:20:13.913 DEBUG (MainThread) [tesla_fleet_api] Response JSON: {'response': {'code': 201, 'message': 'Updated'}}
2024-02-11 19:20:13.913 DEBUG (MainThread) [custom_components.teslemetry] Command result: {'response': {'code': 201, 'message': 'Updated'}}
2024-02-11 19:20:13.914 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472347049280] 'result'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
await entity.async_set_native_value(native_value)
File "/config/custom_components/teslemetry/number.py", line 214, in async_set_native_value
await self.handle_command(self.entity_description.func(self.api, value))
File "/config/custom_components/teslemetry/entity.py", line 86, in handle_command
if not result["response"]["result"]:
~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'result'
Switch Allow exports:
2024-02-11 19:20:29.672 DEBUG (MainThread) [tesla_fleet_api] Sending request to api/1/energy_sites/XXX/grid_import_export
2024-02-11 19:20:29.672 DEBUG (MainThread) [tesla_fleet_api] Body: {'disallow_charge_from_grid_with_solar_installed': True}
2024-02-11 19:20:31.333 DEBUG (MainThread) [tesla_fleet_api] Response Status: 200
2024-02-11 19:20:31.334 DEBUG (MainThread) [tesla_fleet_api] Response JSON: {'response': ''}
2024-02-11 19:20:31.334 DEBUG (MainThread) [custom_components.teslemetry] Command result: {'response': ''}
2024-02-11 19:20:31.335 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472347049280] string indices must be integers, not 'str'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/teslemetry/switch.py", line 169, in async_turn_off
await self.handle_command(self.entity_description.off_func(self.api))
File "/config/custom_components/teslemetry/entity.py", line 86, in handle_command
if not result["response"]["result"]:
~~~~~~~~~~~~~~~~~~^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
from hass-teslemetry.
Right, so energy APIs don't respond the same was as vehicle APIs. Should be an easy fix.
Do you have any idea what an error response looks like? Basically the check I'm doing for vehicles is cases where we return 200 but the command was rejected, for example charging without being plugged in.
from hass-teslemetry.
I don't think we get error responses ;-( You just notice it hasn't changed on the next status polling, which is very sloppy.
The response is also terrible if it is successful:
{"response":""}
The documentation states you should get more ;-(
https://developer.tesla.com/docs/fleet-api#grid_import_export
{
"response": {
"code": 204,
"message": "Updated"
}
}
from hass-teslemetry.
Can you give https://github.com/Teslemetry/hacs-teslemetry/releases/tag/v1.5.0 a try and let me know if it works any better.
from hass-teslemetry.
Loaded up 1.5.0, the error messages have gone, but the switches are still bouncing around per my videos above.
I'll see if I can get some debug logs later.
grid_import_export endpoint:
from hass-teslemetry.
Are the problems only related to the grid_import_export commands now? I do wonder if I have to send both values even though the documentation says they are optional. The best way to do this is either A) give me permission to randomly issue commands to your powerwall, or B) use something like https://hoppscotch.io/ to send the commands to Teslemetry directly and see what does and doesnt work.
from hass-teslemetry.
No there are a range of issues.
I have a TESLA_API_TOKEN as well, and the curl commands work with just one value.
See video below, controlling via curl I switch to pv_only exports, site info is switched immediately, custom components switches after a few moments and Telemetry select is never switched and is still reading Battery when the mode has switched to pv_only:
Screen recording 2024-02-12 21.55.48.webm
Next video I try to switch from Battery to SolarOnly exports via Teslemetry, but the command isn't registered and Teslemerty switches itself back to Battery.
Screen.recording.2024-02-12.22.02.01.webm
Happy to set you up with a HA login on my machine for testing.
from hass-teslemetry.
1.5.8: Allow Charging from Grid switch fails:
2024-02-18 20:25:56.483 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472482639168] 'TeslemetryChargeFromGridSwitchEntity' object has no attribute 'entity_description'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/teslemetry/switch.py", line 246, in async_turn_on
self.set((self.entity_description.key, True))
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TeslemetryChargeFromGridSwitchEntity' object has no attribute 'entity_description'
from hass-teslemetry.
1.5.8: off_grid_reserve
Allows me to change the setting via your slider, even gets a postive response:
2024-02-18 20:29:43.344 DEBUG (MainThread) [tesla_fleet_api] Sending request to api/1/energy_sites/2252097574301386/off_grid_vehicle_charging_reserve
2024-02-18 20:29:43.345 DEBUG (MainThread) [tesla_fleet_api] Body: {"off_grid_vehicle_charging_reserve_percent": 12}
2024-02-18 20:29:45.186 DEBUG (MainThread) [tesla_fleet_api] Response JSON: {'response': {'off_grid_vehicle_charging_reserve_percent': 12}}
2024-02-18 20:29:45.186 DEBUG (MainThread) [custom_components.teslemetry] Command result: {'response': {'off_grid_vehicle_charging_reserve_percent': 12}}
But then during the next status update I get:
'off_grid_vehicle_charging_reserve_supported': False
Enable stom mode switch fails:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:26:53 PM (1 occurrences)
Last logged: 12:26:53 PM
[281472468944704] 'TeslemetryStormModeSwitchEntity' object has no attribute 'entity_description'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/teslemetry/switch.py", line 212, in async_turn_off
self.set((self.entity_description.key, False))
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TeslemetryStormModeSwitchEntity' object has no attribute 'entity_description'
from hass-teslemetry.
off_grid_reserve
should no longer show up when unsupported, and Storm mode and Allow charging from Grid should be fixed in 1.5.5
from hass-teslemetry.
Energy controls working well now.
from hass-teslemetry.
Related Issues (20)
- Model details for Powerwall HOT 3
- Energy remaining sensor - no statistics found HOT 2
- Device registry firmware version doesn't seem to update HOT 1
- Charge Limit temporarily snaps back to previous value after user input HOT 6
- Call:service switch:turn_on against switch.mycar_charge while it is already on gives error HOT 1
- Using service to set number.mycar_charge_limit to its current value gives error, blocks automation HOT 7
- FR: don't force number entities UI presentation to be "box" HOT 1
- Teslemetry command failed, An error occurred while processing the request. HOT 5
- FR/question: Sensor for current driver profile in use? HOT 2
- Service call to navigation_request endpoint gives various errors HOT 3
- Valet Mode switch isn't working HOT 5
- Vent Windows cover isn't working HOT 4
- New (calculated) Sensor: BrickVoltageDelta HOT 1
- Powerwall off_grid_vehicle_charging_reserve_percent not updated in sensor HOT 5
- Storm Mode switch not functional
- Error when sending a command and the car is moving. HOT 3
- Firmware not updated in the integration page HOT 1
- Teslemetry errors in log. Shortly after the errors, Home Assistant crashes HOT 9
- Error starting up with Powerwall only HOT 2
- Setting number.tessy_charge_current complains about number.tessy_charge_limit is outside valid HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hass-teslemetry.