Thank you for the advice. So, here is the flow:
[{"id":"21dfaf285434adc7","type":"tab","label":"Create Average Sensor Data","disabled":false,"info":"","env":[]},{"id":"43d4a83ff8a15b53","type":"inject","z":"21dfaf285434adc7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":320,"wires":[["e8dc2b52101ab6a0"]]},{"id":"e8dc2b52101ab6a0","type":"api-get-history","z":"21dfaf285434adc7","name":"","server":"c6196f00.64307","version":0,"startdate":"","enddate":"","entityid":"sensor.shellys_1_on_time","entityidtype":"is","useRelativeTime":true,"relativeTime":"23h 59m","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":440,"y":380,"wires":[["2f488e0d9cb42ed7"]]},{"id":"2f488e0d9cb42ed7","type":"function","z":"21dfaf285434adc7","name":"","func":"msg.payload = msg.payload[msg.payload.length-1].state;\nnode.warn(msg.payload);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":360,"wires":[["238e0ead9b52c6f9"]]},{"id":"238e0ead9b52c6f9","type":"ha-entity","z":"21dfaf285434adc7","name":"shellys_1_historic","server":"c6196f00.64307","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"shellys_1_historic"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"h"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":880,"y":360,"wires":[[]]},{"id":"c6196f00.64307","type":"server","name":"Home Assistant","version":2,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
the function:
msg.payload = msg.payload[msg.payload.length-1].state;
node.warn(msg.payload);
return msg;
Entity node.
Just from the server controls:
Nope, just some information when it registered (see screenshot above).
If I can give any more information, just fire away!