![]() |
|
Aseko Asin Aqua Home - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Aseko Asin Aqua Home (/showthread.php?tid=6040) |
Aseko Asin Aqua Home - hocine - 02.07.2025 hello, I have this product to manage my pool https://www.asekopool.com/fr/asin-aqua-home-fr/ and I have retrieved this file but I don't know where to start to create a json to be able to integrate it on my LM. RE: Aseko Asin Aqua Home - Daniel - 02.07.2025 Json profiles are for modbus integration where this seems like some custom RS485 protocol. Here is serial library: https://kb.logicmachine.net/libraries/serial/ RE: Aseko Asin Aqua Home - hocine - 02.07.2025 (02.07.2025, 11:05)Daniel Wrote: Json profiles are for modbus integration where this seems like some custom RS485 protocol. Here is serial library: Code: do you think it will work like this ?
-- Charger la bibliothèque série
require('serial')
-- Ouvrir le port série RS-485
if not port then
port = serial.open('/dev/RS485', {
baudrate = 57600,
parity = 'none',
databits = 8,
stopbits = 1,
duplex = 'half'
})
port:flush()
end
-- Fonction pour convertir les octets en valeur numérique
local function to_decimal(high, low, factor)
return (high * 256 + low) / factor
end
-- Port prêt pour la lecture
if port then
-- Lire un paquet de données
local data, err = port:read(27, 2) -- Lire 27 octets
if data then
local bytes = {string.byte(data, 1, 27)}
-- Extraction des données
local ph_value = to_decimal(bytes[3], bytes[4], 100)
local ph_required = bytes[17] / 10
local cl_rx_value = to_decimal(bytes[5], bytes[6], 100)
local cl_rx_required = bytes[18] / 10
local temperature = to_decimal(bytes[9], bytes[10], 10)
local error_1 = bytes[11]
local error_2 = bytes[24]
local unit_type = bytes[2]
-- Écriture des valeurs sur le bus KNX
grp.write('1/1/1', ph_value)
grp.write('1/1/2', ph_required)
grp.write('1/1/3', cl_rx_value)
grp.write('1/1/4', cl_rx_required)
grp.write('1/1/5', temperature)
grp.write('1/1/6', error_1)
grp.write('1/1/7', error_2)
grp.write('1/1/8', unit_type)
-- Journaux pour chaque information
print(string.format("pH: %.2f, pH requis: %.1f", ph_value, ph_required))
print(string.format("CL/RX: %.2f, CL/RX requis: %.1f", cl_rx_value, cl_rx_required))
print(string.format("Température: %.1f °C", temperature))
print(string.format("Erreur 1: %d, Erreur 2: %d", error_1, error_2))
print(string.format("Type d'unité: %d", unit_type))
else
print("Erreur de lecture des données: " .. tostring(err))
end
-- Fermeture du port pour éviter de laisser la connexion ouverte
port:flush()
port:close()
endRE: Aseko Asin Aqua Home - Daniel - 03.07.2025 Do you use LM? RE: Aseko Asin Aqua Home - admin - 03.07.2025 Don't close the port after the first read operation. You should also check the starting byte value and whether calculated CRC matches the last byte. Otherwise you might get incorrect data occasionally. RE: Aseko Asin Aqua Home - hocine - 07.07.2025 (03.07.2025, 07:13)Daniel Wrote: Do you use LM? YES |