Page 2 sur 2
Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 05 juil. 2020, 16:07
par knOx
Au fur et mesure de vous lire ça avance :
Code : Tout sélectionner
commandArray = {}
if (devicechanged['ThermostatMaster']) -- changement d'état physique ou virtuel du thermostat Netatmo
then
setPointValue = otherdevices_svalues['ThermostatMaster']-- on injecte dans une Variable
setPointValue2 = otherdevices_svalues['ThermostatMaster']-- on injecte dans une Variable
sTemp, sHumid = otherdevices_svalues['SondeSalon']:match("([^;]+);([^;]+)") -- on récupère la température & l'humidité fournie par la sonde Netatmo weather interior
sTemp = tostring(sTemp) -- on injecte dans une Variable tempo en convertissant la valeur en string pour injection dans une user Variable
sHumid = tostring(sHumid)
commandArray['Variable:ThermoMaster'] =setPointValue -- on injecte dans une Variable de type chaine
commandArray['Variable:ThermoMast'] =sTemp -- on injecte dans une Variable de type chaine
--logs
print(sTemp) --Valeur Temp SondeSalon
print(sHumid) --Valeur Hum SondeSalon
print (setPointValue)
print (setPointValue2)
end
Maintenant faut comparer la valeur des sondes avec celle du thermostat et changer la valeur du switch selector : /
Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 06 juil. 2020, 07:29
par knOx
Mise au propre et début d’interaction avec PAC :
Code : Tout sélectionner
--------------
-- VARIABLES--
--------------
local sonde = 'SondeSalon'
local hysteresis = tonumber('0.5')
local climatiseurSalon = 'SalonClimMode'
local consigne = tostring(otherdevices_svalues['ThermostatMaster'])
local setPointValue = tonumber(otherdevices_svalues['ThermostatMaster'])
local setPointValue2 = tonumber(otherdevices_svalues['ThermostatMaster'])
local sTemp, sHumid = otherdevices_svalues['SondeSalon']:match("([^;]+);([^;]+)") -- on récupère la température & l'humidité fournie par la sonde Netatmo weather interior
sTemp = tonumber(sTemp) -- on injecte dans une Variable tempo en convertissant la valeur en string pour injection dans une user Variable
sHumid = tostring(sHumid)
--------------
--- SCRIPT ---
--------------
commandArray = {}
if (devicechanged['ThermostatMaster']) -- changement d'état physique ou virtuel du thermostat Netatmo
then
if (devicechanged['ThermostatMaster']) then
if (sTemp > (consigne + hysteresis) and otherdevices['climatiseurSalon']=='Off') then
print('Allumage du climatiseur Salon')
domoticz.device('climatiseurSalon').switchSelector(50)
elseif (sTemp < (consigne - hysteresis) and otherdevices['climatiseurSalon']=='Auto') then
print('Extinction du climatiseur Salon')
domoticz.device('climatiseurSalon').switchSelector(0)
end
end
--logs
print(sTemp) --Valeur Temp SondeSalon
print(sHumid) --Valeur Hum SondeSalon
print (setPointValue)
print (setPointValue2)
end
return commandArray
Sauf que le switchSelector ne fonctionne pas :/ si quelqu'un à une idée ?

Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 06 juil. 2020, 12:46
par Keros
knOx a écrit : 06 juil. 2020, 07:29
domoticz.device('climatiseurSalon').switchSelector(0)
Ceci est une commande DZvents ...
Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 06 juil. 2020, 18:02
par knOx
Keros a écrit : 06 juil. 2020, 12:46
knOx a écrit : 06 juil. 2020, 07:29
domoticz.device('climatiseurSalon').switchSelector(0)
Ceci est une commande DZvents ...
Ah ben je teste

, du coup faute de réponses, j'étais sur Grafana pour patienter.

- CaptureGrafana.JPG (60.9 Kio) Consulté 2728 fois
Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 08 juil. 2020, 07:09
par knOx
ça avance :
Code : Tout sélectionner
--------------
-- VARIABLES--
--------------
local sonde = 'SondeSalon'
local hysteresis = tonumber('0.5')
local climatiseurSalon = 'Climatiseur_Salon_Mode'
local consigne = tonumber(otherdevices_svalues['ThermostatMaster'])
local setPointValue = tonumber(otherdevices_svalues['ThermostatMaster'])
local setPointValue2 = tonumber(otherdevices_svalues['ThermostatMaster'])
local sTemp, sHumid = otherdevices_svalues['SondeSalon']:match("([^;]+);([^;]+)") -- on récupère la température & l'humidité fournie par la sonde Netatmo weather interior
sTemp = tonumber(sTemp) -- Valeur de la SondeSalon
sHumid = tostring(sHumid)
--------------
--- SCRIPT ---
--------------
commandArray = {}
if (devicechanged['ThermostatMaster']) -- changement d'état physique ou virtuel du thermostat Netatmo
then
print('Allumage du climatiseur Salon')
-- commandArray['UpdateDevice']='141|0|50'
-- self.jsonAPI('type=command¶m=udevice&idx=141&nvalue=0&svalue=50')
AutoUrl = tostring('localhost:8080/json.htm?type=command¶m=udevice&idx=141&nvalue=0&svalue=50'
commandArray['OpenURL'] = AutoUrl
end
--logs
print('Température Sonde Salon '..sTemp) --Valeur Temp SondeSalon
print('Humidité Sonde Salon '..sHumid) --Valeur Hum SondeSalon
print ('Consigne Thermostat Netatmo '..setPointValue)
return commandArray
Pour l'instant je reste simple tant que les fonctions de base ne marche pas.
Là j'ai une erreur sur le json dans les logs, URL testé avec user@password, fonctionne pas non plus. J'ai commenté aussi au dessus deux essais.
Si quelqu'un à une idée ?

Re: Automatision Clim Melcloud via Netatmo Thermostat & Weather
Publié : 09 juil. 2020, 09:18
par knOx
(journal de bord J+3)
Enfin un bout de code qui fonctionne, bon ce n'est que le début :
- aucunes optimisations faudrait réduire les commandes
- appeler les valeurs et les envoyer dans des variables
- manquer aussi une fonction de comparaison pour les valeurs des sondes et le thermostat principal.
Code : Tout sélectionner
--
txtCmd = 'Climatiseurs en pilotage Netatmo, thermostat réglé à '
commandArray = {}
if (devicechanged['ThermostatMaster'])
then
modeClimSalon = otherdevices['Climatiseur_Salon_Mode']
fanSpeed = otherdevices['Climatiseur_Salon_Fan']
climSalonTemp = otherdevices['Climatiseur_Salon_Temp']
sTemp, sHumid = otherdevices_svalues['SondeSalon']:match("([^;]+);([^;]+)") -- on récupère la température & l'humidité fournie par la sonde Netatmo weather interior
temperature = math.ceil(sTemp)n
if (modeClimSalon == 'Off') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
elseif (modeClimSalon == 'Warm') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
elseif (modeClimSalon == 'Cold') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
elseif (modeClimSalon == 'Vent') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
elseif (modeClimSalon == 'Dry') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
elseif (modeClimSalon == 'Auto') then commandArray['Climatiseur_Salon_Mode'] = 'Set Level: 50'
end
if (fanSpeed == 'Level1') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Level2') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Level3') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Level4') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Level5') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Auto') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
elseif (fanSpeed == 'Silence') then commandArray['Climatiseur_Salon_Fan'] = 'Set Level: 50'
end
temperatureCmd = tonumber(temperature)
setPointValue = math.floor(otherdevices_svalues['ThermostatMaster'])
print(string.format('Thermostat %s, Température %s', setPointValue, sTemp))
modeCmd = txtCmd .. ','.. climSalonTemp
print(string.format('Température Thermostat NetAtmo %s °, Temperature Clim Master: %s, Température : %s°C, modeCmd: %s°C', modeClimSalon, fanSpeed, temperature, modeCmd))
print(string.format('Mode climatiseurs: %s, Mode de ventilation: %s, Température : %s°C, modeCmd: %s°C', modeClimSalon, fanSpeed, temperature, modeCmd))
end
return commandArray
Merci aux membres du forum de partager vos scripts, très inspirants, j'aime beaucoup ceux de Poo.
