(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.
