Open AlexanderSchulz-Siemens opened 4 months ago
I already implemented a package to parse json objects into ioBroker states maybe this can help here. https://github.com/TA2k/json2iob
It looks like exactly what I want so why was it not listed in the adapters section? I searched for json and found nothing.
@TA2k Lets collaborate and I implement your library into an adapter?
json2iob is no adapter but a callable npm pacakge o be used by js code
I would suggest you open a issue at the adapter where you are missing expanded infomation. Expanding json data without knowlegde about the contents is not desired, as setting meaningful units and roles would not be possible.
json states can be used by scripts without any problems. And - as far as I know - json data can be used by some widgets within visualisation too.
@mcm1957 it looks like json2iob
detect roles and such, thats not the issue. Maybe it doesn't need be that sophisticated every time. Maybe a plain state with appropriate type is enough for most cases. At least on my side.
I already checked the ical repository, there are multiple issues asking for having individual states for each event. My tasmota topics for example are directly in the mqtt instance, no separate adapter in this case.
I think there are plenty usecases where an expanded state with basic type (string, number, boolean, ...) is enough to make further automations much easier. Most users don't want to fiddle with scripts that much and would appreciate a simple solution. You can easily set roles and such afterwards manually if you really need it.
What kind of device or service would you like to see an adapter for? Expand json state values into individual states. E.g., Tasmota provides sensor information in the state
SENSOR
. There is no way to work with this data other than parsing it in scripts. Furthermore you can not configure triggers on this data because it will trigger for every change and not only for e.g.SENSOR.ENERGY.Power
.Is the device connected to the internet or only available on a local network? local
Is an official App or Website available? no
Is an official API including documentation available? not applicable
Are other libraries for an integration available? no
Is this device already integrated in other Smart Home systems? not applicable
Is this device already integrated in homebridge? Might the ham adapter in combination with the homebridge plugin be sufficient? not applicable
Additional context Some adapters states contain json content. In order to be able to work with the content of the json, the data needs to be parsed in JS or any other kind of script. For beginners this is not very handy and also for more advanced users it is a little bit annoying writing scripts for each state or adapter in order to access the data which is need.
A few examples of how this adapter works:
Tasmota Sensor Values The reason why smart plugs with power metering are used is often times to react to certain states of said power metering. Tasmota provides all sensor information in a single state
tele.SENSOR
.iCal Events iCal only provides boolean states for events. If the pattern matches the event it will set
events.0.now.<Eventname> = true
. However, there is no further information for this event other than in thedata.table
state. The table state holds all events and needs to be parsed to extract more information. Using jsonExpand this information can be split into separate states for each event.Now with the individual states triggers can be implemented more efficiently and also custom settings can be made for each state.
I have already implemented this via Typescript but am planning to release a adapter which will add a custom setting for each state which allows you to expand this state into either
SENSORx
which indicates this state has been expanded from stateSENSOR
0_userdata