Closed sveinse closed 1 year ago
Hmm, how does this if a user has multiple chargers that they have access to? Lets say one new one and one old?
We are still just pushing data into self.obs
Not all the observation has the same key/value: key ChargeCurrentInstallationMaxLimit Observations 707 Apollo 546
Can you check this one? I don't think its that important. As long as we add the value as a key so we know the correct attribute to update if the user is using the servicebus
The data in self.obs are only used one way, right? Even though the dict is populated for two way use (obs[k] = v; obs[v] = k
). My assumptions have been that two different devices might use two different IDs for the same thing. I hope that the same ID won't be reused for a completely different thing in another device (collision). If that's the case we'll need to have have device specific ID-lists.
I'll check for collisions with the charger I have.
I made the following snippet shown below to find if there are names using multiple IDs and IDs having multiple names. The findings for all device schemas included in the const file gives the following overlap. They seem pretty related to me, which I think is good for doing it this way.
Found ChargeCurrentInstallationMaxLimit with multiple values {546, 707}
Found 202 with multiple values {'TemperatureEMeterPhase1', 'TemperatureInternal6'}
Found 205 with multiple values {'TemperaturePowerBoard', 'TemperatureEMeterPhase3'}
Found 522 with multiple values {'ChargerOfflinePhase', 'VoltageEnergyLevel'}
Found 813 with multiple values {'McuToVariscitePacketErrors', 'McuToESPPacketErrors'}
Found 814 with multiple values {'ESPToMcuPacketErrors', 'VarisciteToMcuPacketErrors'}
Found 820 with multiple values {'UptimeESP', 'UptimeVariscite'}
Found 911 with multiple values {'SoftwareApplicationVersion', 'SmartComputerSoftwareApplicationVersion'}
Found 913 with multiple values {'HardwareVersion', 'SmartComputerHardwareVersion'}
Found 970 with multiple values {'FactoryTestStage', 'ProductionTestStationNumber'}
Found 1000 with multiple values {'MeterId', 'AMSMeterId'}
Found 1001 with multiple values {'AMSMeterType', 'MeterType'}
stats = {}
async with aiohttp.request("GET", CONST_URL) as resp:
if resp.status == 200:
data = await resp.json()
for k, v in data.items():
if k in wanted:
for a, b in v.items():
stats.setdefault(a, []).append(b)
stats.setdefault(b, []).append(a)
# Get from Schema.<Name>.ObservationIds for those where
# Schema.<Name>.DeviceType matches the list in device_types
if device_types and k == "Schema":
for schema in v.values():
if 'ObservationIds' in schema:
for a, b in schema['ObservationIds'].items():
stats.setdefault(a, []).append(b)
stats.setdefault(b, []).append(a)
for k, v in stats.items():
sv = set(v)
if len(sv) > 1:
_LOGGER.error("Found %s with multiple values %s", k, sv)
The data in self.obs are only used one way, right? Even though the dict i
No, its is not, it allows two-way because the data from the servicebus only contains the StateID
The data in self.obs are only used one way, right? Even though the dict i
No, its is not, it allows two-way because the data from the servicebus only contains the StateID
Yes, everything from the API use numerical IDs and needs translation into string. But the opposite direction from name to ID, is that ever used?
This PR can be closed if PR #56 is implemented.
Superseded by #56. Closing PR
The Zaptec constants JSON contains in addition to the global generic id mappings, contain device specific schemas. This PR adds support for appending the device type specific ids list with the generic id list. It will significantly reduce the number of
Couldnt find a remap string for %s report it %s"
messages in the log.