SELECT time_fired AS "time",
'湿度' as metric,
CAST(state AS DECIMAL(4,2)) as value
FROM `events` as E
INNER JOIN `states` as S
ON E.event_id = S.event_id
WHERE E.event_type = 'state_changed'
#and JSON_EXTRACT(E.event_data, '$.entity_id') = 'sensor.a4c138a5028c'
and S.entity_id = 'sensor.a4c138a5028c_humidity'
ORDER BY E.created ASC