17.10.2022, 09:53
(14.10.2022, 06:17)admin Wrote: Use this (1/1/1 is battery object, 1/1/2 is target temperature value object):Hi admin,
Code:mqtt_to_object = {
['shellies/shellytrv-14B457E5C2C8/info'] = '1/1/1',
}
mqtt_to_object_conv = {
['shellies/shellytrv-14B457E5C2C8/info'] = function(payload)
local data = require('json').pdecode(payload)
if type(data) == 'table' then
grp.write('1/1/2', data.target_t.value)
return data.bat
end
end
}
Data.target_t.value does not work. This is a log from data, and from data.thermostats, how should I get the target_t ? If I have many shelits for each, should I add it this way?
Code:
log (data)
["ps_mode"]
* number: 0
["thermostats"]
* table:
[1]
* table:
["tmp"]
* table:
["is_valid"]
* bool: true
["units"]
* string: C
["value"]
* number: 24.7
["pos"]
* number: 50
["target_t"]
* table:
["value_op"]
* number: 8
["enabled"]
* bool: false
["units"]
* string: C
["value"]
* number: 22
["window_open"]
* bool: false
["boost_minutes"]
* number: 0
["schedule"]
* bool: false
["schedule_profile"]
* number: 1
["fs_free"]
* number: 59376
["wifi_sta"]
* table:
["connected"]
* bool: true
["rssi"]
* number: -59
["ssid"]
* string: Project Solutions
["ip"]
* string: 10.0.5.105
["dbg_flags"]
* number: 0
["mac"]
* string: 14B457E5C2C8
["cloud"]
* table:
["connected"]
* bool: false
["enabled"]
* bool: false
["time"]
* string: 12:47
["update"]
* table:
["new_version"]
* string: 20220811-152343/v2.1.8@5afc928c
["old_version"]
* string: 20220811-152343/v2.1.8@5afc928c
["status"]
* string: unknown
["beta_version"]
* userdata: NULL
["has_update"]
* bool: false
["bat"]
* table:
["voltage"]
* number: 4.077
["value"]
* number: 99
["unixtime"]
* number: 1666000030
["ram_total"]
* number: 97280
["fw_info"]
* table:
["fw"]
* string: 20220811-152343/v2.1.8@5afc928c
["device"]
* string: shellytrv-14B457E5C2C8
["calibrated"]
* bool: true
["uptime"]
* number: 5326
["charger"]
* bool: false
["ram_free"]
* number: 22568
["actions_stats"]
* table:
["skipped"]
* number: 0
["serial"]
* number: 0
["mqtt"]
* table:
["connected"]
* bool: true
["has_update"]
* bool: false
["cfg_changed_cnt"]
* number: 0
["fs_size"]
* number: 65536
log(data.thermostats)
[1]
* table:
["tmp"]
* table:
["is_valid"]
* bool: true
["units"]
* string: C
["value"]
* number: 24.7
["pos"]
* number: 50
["target_t"]
* table:
["value_op"]
* number: 8
["enabled"]
* bool: false
["units"]
* string: C
["value"]
* number: 22
["window_open"]
* bool: false
["boost_minutes"]
* number: 0
["schedule"]
* bool: false
["schedule_profile"]
* number: 1