Maybe I don’t fully understand yet, or perhaps I have my terminology confused, but there are really 2 different endpoints as I see it, and each set of entities that I call an update_entity for, are for a single one of those endpoints.
To put all my proverbial cards on the table, here’s (part of) my RESTful configuration for the sensors (non-essential info left out):
- scan_interval: 0
resource: http://localhost:8085/mbus/get/ttyUSB0/9600/1
sensor:
- name: "Solar System Energy Production Total"
unique_id: solar_system_energy_production_total
- name: "Solar System Energy Consumption Total"
unique_id: solar_system_energy_consumption_total
- scan_interval: 0
resource: http://localhost:8085/mbus/get/ttyUSB0/9600/10010000FFFFFFFF
sensor:
- name: "Solar System Voltage"
unique_id: solar_system_voltage
- name: "Solar System Current"
unique_id: solar_system_current
- name: "Solar System Active Power"
unique_id: solar_system_active_power
- name: "Solar System Reactive Power"
unique_id: solar_system_reactive_power
- name: "Solar System Power Factor"
unique_id: solar_system_power_factor
- name: "Solar System Frequency"
unique_id: solar_system_frequency
I would think that these 2 resources are 2 different endpoints, as they are different URL’s (different MBus addresses), is that a correct assessment?
Building on that assumption, my automation is listed in the previous post, but I’ll paste the relevant parts of the “action” sequences here again:
sequence:
- service: homeassistant.update_entity
target:
entity_id:
- sensor.solar_system_active_power
- sensor.solar_system_current
- sensor.solar_system_frequency
- sensor.solar_system_power_factor
- sensor.solar_system_reactive_power
- sensor.solar_system_voltage
and:
sequence:
- service: homeassistant.update_entity
target:
entity_id:
- sensor.solar_system_energy_production_total
- sensor.solar_system_energy_consumption_total
As is evident, all (6) entities in the first sequence belong to a single defined endpoint (http://localhost:8085/mbus/get/ttyUSB0/9600/10010000FFFFFFFF), and all (2) of the entities in the second sequence belong to the other defined endpoint (http://localhost:8085/mbus/get/ttyUSB0/9600/1).
Most of the time, the corresponding endpoint is queried (once) almost immediately after calling the update_entity. But not always…
Sometimes there’s a (too) long delay before the commands are executed, and both differing endpoints are queried at the same time. Or, at least too close in time to be processed both, since these API endpoints take a few hundreds of milliseconds to return their data, it’s a serial bus after all.
Since the MBus can not be queried more than once simultaneously, one of the API calls will not return data at all, causing the corresponding entities to change their state to ‘unknown’.
That’s what I try to avoid.
Before I go and try to tinker with rest_commands and response_variables, would you have any comments on the above configuration?