Open elad-bar opened 4 days ago
@elad-bar is this a WARN or an ERROR?
Also - this looks the IEC API doesn't consider your account as a private producer .
Can you check the response of contracts
? specifically fromPrivateProducer
field (in the response it's fromPativteProducer
🤦🏻 )
an assumption why it happens, I have PV panels and i'm producing on top of consuming on the same meter, maybe bill estimation is not supported for PV Products device type (3) as there is no isolation between incoming and outgoing support by IEC.
more details about the questions:
it looks like unhandled error, weird thing about this error is - it is not available in the regular log of HA, it is being catch as system error (sent to my Syslog Server),
I can see that the function that it happens in is _estimate_bill
line 632 but there is an issue logging it as states in the exception:
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/util/logging.py", line 41, in handle
the root cause is this line:
last_meter_read = int(devices_by_id.counter_devices[0].last_mr)
the response of devices by devices id is:
{
"data": {
"counterDevices": null,
"mrType": "00"
},
"reponseDescriptor": {
"isSuccess": false,
"code": "08",
"description": "No authorization for this product: PV Product"
}
}
which makes extracting the last_mr
of the first device to fail (it is null / None as stated in the error),
according to the error in the description of the request - No authorization for this product: PV Product.
regarding the second question - fromPativteProducer is false
Response of contract:
{
"data": {
"contracts": [
{
"address": "***",
"contractId": "***",
"dueDate": "1900-01-01",
"totalDebt": 0.0,
"frequency": 2,
"status": 1,
"fromPativteProducer": false,
"cityCode": "***",
"cityName": "***",
"streetCode": "***",
"streetName": "***",
"houseNumber": "***",
"debtForInvoicesDueDateNotPassed": 0.0,
"isTouz": false,
"smartMeter": true,
"producerType": 2,
"isDomestic": true
}
],
"contractAmount": 1,
"totalToPay": 0.0
},
"reponseDescriptor": {
"isSuccess": true,
"code": "0",
"description": ""
}
}
This is indeed a full and correct analysis.
The reason device_by_device_id is needed is for last meter reading, i wonder if I could get this from a different api.
Also, @elad-bar - any idea what's producerType:2
- I only saw 1
so far. Is it PV producer?
looked over the api/translation files couldn't find what is producer type enums values, found an article about IEC:
https://www.lnrg.technology/2024/08/07/overview-of-the-israeli-electricity-market-2024/
maybe values are IEC, P2IEC, P2P I'm have PV panels so i'm producer and consumer
tried to find over the api some indication for the estmations, but it's not available so I guess for my consumer type, which is ok, but the code should not allow those entities and claculation for producerType == 2
I agree, but I want to cover more ground here. For example - I want to get few questions answered -
contract
(from API)? Only Account? (I'm assuming you're using just a single customer
).GET https://iecapi.iec.co.il/api/Device/{{contract_id}}/{{device_id}}
- can you get last meter (consumption) reading?I have 1 contract in the array of contracts (from Postman), I have 1 device although in the website of IEC I have 2 devices (1 was available up until 1.5 years ago, so I guess it's just for reviewing historical data).
I can see the current consumption and wanted to open another issue for that, I see today's consumption in 1 day lag, meaning, in the result i can see today's consumption, but the data that available in the integration is for yesterday (compared to IEC portal).
Endpoint: https://iecapi.iec.co.il/api/Consumption/RemoteReadingRange/{{contract_id}}
in the following endpoint I can see both devices: https://iecapi.iec.co.il/api/Device/LastMeterReading/{{contract_id}}/{{bp_number}}
If you would like me to check it though Postman you created I think it would be much faster, I can also change the code locally according to your suggestion and test it.
Thanks. Ill keep you posted on this thread with check requests.
Which sensor/state do you see in 1 day delay?
Today's consumption, Thanks a lot for the integration and the super quick response
TodayConsumption is fetched by trying to get (and sum) today's hourly readings. Often you'll see in IEC site discrepancy between hourly view and daily view etc. I think this is what causes this
is fetched by trying to get (and sum) today's hourly read
opened another issue about it, there are huge gaps and suggested solution following what is being done in IEC portal (different resolution, no need to aggregate / calculate)
@elad-bar - correct, only the data is usually behind the hourly check so this is a mitigation for get a (latest) data
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1441 Downloaded Repositories | 47Home Assistant Cloud
logged_in | true -- | -- subscription_expiration | March 17, 2025 at 2:00 AM relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-15.ui.nabu.casa certificate_status | ready instance_id | --- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okDashboards
dashboards | 4 -- | -- resources | 19 views | 17 mode | storageRecorder
oldest_recorder_run | October 11, 2024 at 11:11 AM -- | -- current_recorder_run | October 13, 2024 at 9:01 AM estimated_db_size | 1551.14 MiB database_engine | mysql database_version | 11.3.2Spotify
api_endpoint_reachable | ok -- | --Checklist
Describe the issue
Error is being logged every HA restart
Reproduction steps
Debug logs
Diagnostics dump
No response