Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Netatmo plug-in


Guest Lode

Question

Guest Lode

Is this why Netatmo plug-in stops working after about 3 hours ?

Please login or register to see this link.

Link to comment
Share on other sites

Recommended Posts

  • 0

Hi,

I get the following error if I run the debug of the scene:

 

LUA Error:/opt/fibaro/scenes/15.lua:97: attempt to concatenate global 'rain_id' (a nil value)

 

Where could be the error?

 

 

Link to comment
Share on other sites

  • 0
On ‎28‎/‎09‎/‎2016 at 6:55 AM, Sankotronic said:

What scene?

 

Hi,

 

this is the scene:

 

--[[

%% properties

%% autostart

%% globals

--]]
 
-- DIESE DATEN ANPASSEN
local client_id = 'xxx'
local client_secret = 'xxx'
local username =

Please login or register to see this link.


local password = 'xxx'
local refresh = 300
local debug = 1
 
local vd_ID = 178
 
-- AB HIER NICHTS MEHR ANPASSEN
local token = ''
local request_body = ''
local rains = {hour = -1000, day = -1000, week = -1000, month = -1000}
 
local sourceTrigger = fibaro:getSourceTrigger()
 
Debug = function ( color, message )
  fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
end
 
DebugError = function ( color, message )
  fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
end
 
Debug( 'orange', 'netatmo Zusatzmodul Integration v.1.2 gestartet.' )
Debug( 'white', 'Daten werden alle 5 min aktualisiert. Bei debug = 0 wird nichts debuggt' )
 
function oAuth(nextFunction)
 local request_body = 'grant_type=password&client_id=' .. client_id .. '&client_secret=' .. client_secret .. '&username=' .. username .. '&password=' .. password .. '&scope=read_station'
 getResponseData('https://api.netatmo.net/oauth2/token', request_body,
     function(data)
      if (data.access_token ~= nil) then
        token = data.access_token
        if (debug == 1) then
        Debug( 'green', 'oAuth 2.0 durchgeführt.' )
        end
        getDevices()
        fibaro:call(vd_ID, 'pressButton', '9')
      else
        DebugError( 'red', 'oAuth 2.0 konnte nicht durchgeführt werden! Bitte die Anmeldedaten überprüfen')
      end
    end
    )
    setTimeout(oAuth, refresh*1000);
end
 
function getResponseData(url, body, func)
 local http = net.HTTPClient()
 http:request(url, {
 options = {
 method = 'POST',
         headers = {
 ['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
 },
 data = body
 },
 success = function(response)
 func(json.decode(response.data))
 end
 })  
end
 
function getDevices()
 getResponseData('https://api.netatmo.net/api/devicelist','access_token='..token,
 function(data)
 if (data.body ~= nil) then
  if (debug == 1) then
    Debug( 'green', 'netatmo Sensoren werden gesucht...' );
  end
  for _, v in pairs(data.body.modules) do
       --fibaro:debug('Tabelle auslesen')
           if (v.data_type[1] == 'Rain') then
              rain_id = v._id
              if (debug == 1) then
                Debug( 'green', 'Regensensor ' ..rain_id.. ' erkannt.' );
              end
              if rain_id ~= nil then
                getSumRain(60 * 60, 'hour')
                getSumRain(60 * 60 * 24, 'day')
                getSumRain(60 * 60 * 24 * 7, 'week')
                getSumRain(60 * 60 * 24 * 30, 'month')
              end
           elseif (v.data_type[1] == 'Wind') then
              wind_id = v._id
              if (debug == 1) then
                Debug( 'green', 'Windmesser ' ..rain_id.. ' erkannt.' );
              end
              if wind_id ~= nil then
                getmeasureWind()
              end
           end
         int_id = data.body.devices[1]._id
         end
  else
      DebugError( 'red', 'device-list konnte nicht abgefragt werden! Bitte nächsten Durchlauf abwarten')
  end
 end
    )
end
 
function getmeasureWind()
   request_body_wind = 'access_token='..token..'&device_id='..int_id..'&module_id='..wind_id..'&scale=max&type=WindStrength,WindAngle,GustStrength,GustAngle&date_end=last'
   getResponseData('https://api.netatmo.net/api/getmeasure', request_body_wind,
 function(getData)
   if (getData.body ~= nil) then
      if (debug == 1) then
        Debug( 'green', 'Windmesser wird ausgelesen...' );
      end
       WindStrength = getData.body[1].value[1][1]
       WindAngle = getData.body[1].value[1][2]
       GustStrength = getData.body[1].value[1][3]
       GustAngle= getData.body[1].value[1][4]
       if (debug == 1) then
        Debug( 'green', 'Windgeschwindigkeit: ' .. WindStrength .. ' km/h' );
       end
        if fibaro:getGlobalValue('windstaerke') ~= nil then
        fibaro:setGlobal('windstaerke', WindStrength)
       else
        DebugError( 'red', 'Varible windstaerke nicht gefunden. Bitte anlegen')
       end
       if fibaro:getGlobalValue('windrichtung') ~= nil then
        fibaro:setGlobal('windrichtung', WindAngle)
       else
        DebugError( 'red', 'Varible windrichtung nicht gefunden. Bitte anlegen')
       end
       if fibaro:getGlobalValue('boenstaerke') ~= nil then
        fibaro:setGlobal('boenstaerke', GustStrength)
       else
        DebugError( 'red', 'Varible boenstaerke nicht gefunden. Bitte anlegen')
       end
       if fibaro:getGlobalValue('boenrichtung') ~= nil then
        fibaro:setGlobal('boenrichtung', GustAngle)
       else
        DebugError( 'red', 'Varible boenrichtung nicht gefunden. Bitte anlegen')
       end
       if (debug == 1) then
        Debug( 'green', 'Windmesser auslesen beendet.' );
       end
   else
     DebugError( 'red', 'API-Call konnte nicht durchgeführt werden! API nicht erreichbar! Bitte nächsten Durchlauf abwarten.')
   end
 end
 )
end
 
function getSumRain(dauer, variable)
 local now = os.time();
 getResponseData('https://api.netatmo.net/api/getmeasure','access_token='..token..'&device_id='..int_id..'&module_id='..rain_id..'&scale=1hour&type=sum_rain&real_time=true&date_begin='..os.date('!%c', (now - dauer)),
 function(data)
       local sum_rain  = 0
            for k, v in pairs(data.body) do
              for l, w in pairs(v.value) do
                  sum_rain = sum_rain + w[1]
              end
            end
            if fibaro:getGlobalValue('rain_' ..variable) ~= nil then
               fibaro:setGlobal('rain_' ..variable, sum_rain)
            else
            DebugError( 'red', 'Varible rain_' ..variable.. ' nicht gefunden. Bitte anlegen')
            end
          if (debug == 1) then
           fibaro:debug('Regenmenge: ' ..sum_rain.. ' mm2 (' .. variable .. ')')
          end
 end
 )
end
 
if (sourceTrigger['type'] == 'autostart') then
 oAuth();
end

Link to comment
Share on other sites

  • 0

Hello,

I try to install my Netatmo Thermostat to my Home Center Lite. I did everything step by step. Plugin installed from Fibaro store, I connected my account and so... but the <get device> button doesn’t work. 
Do you have any suggestion? 
Thanks in advance,

 

Please login or register to see this image.

/monthly_2016_10/57ff2b86e9612_ScreenShot2016-10-13at09_36_16.png.fce66de0fbd6ac5b7baad71b7cd709ee.png" alt="Screen Shot 2016-10-13 at 09.36.16.png" />

Link to comment
Share on other sites

  • 0
On 13.10.2016 at 8:39 AM, omer said:

Hello,

I try to install my Netatmo Thermostat to my Home Center Lite. I did everything step by step. Plugin installed from Fibaro store, I connected my account and so... but the <get device> button doesn’t work. 
Do you have any suggestion? 
Thanks in advance,

 

Please login or register to see this link.

Hello,

 

Do not post the same exact message in multiple threads. You was warned, next time you will be temporary banned.

 

What "get device" button? There is no such button in your screenshots.

Link to comment
Share on other sites

  • 0

Sorry, I didn't know that.

 

One more screenshot.

 

Please login or register to see this image.

/monthly_2016_10/5808c69d26946_ScreenShot2016-10-20at16_27_12.png.693e89b599f78b66338a4b5e6a692918.png" alt="Screen Shot 2016-10-20 at 16.27.12 .png" />

Link to comment
Share on other sites

  • 0

for HomeSystem.sk:  I think that the way is simple reinstal plug-in :-)

for viga81: be careful, in code is mistake, 2 times is  Debug( 'green', 'Regensensor ' ..rain_id.. ' erkannt.' ); and  Debug( 'green', 'Windmesser ' ..rain_id.. ' erkannt.' ); --> in second one must be wind_id!

      Don't forget manually create Global variables:  windstaerke,  windrichtungboenstaerkeboenrichtung !

 

 

Please login or register to see this attachment.

Edited by Peterko
additional info.
Link to comment
Share on other sites

  • 0

Hi guys,

 

I newbie on the forum and this is my first post :)

Is Rain Gauge from Netatmo working with recent beta HC2 firmware and plugin ? I can see 2 devices in HC2 but no readings.

Edited by karolek75
Link to comment
Share on other sites

  • 0

Hi everyone!

This is my very first post and I'm totally new to Fibaro world, so please pardon me if I'm not clear or correct.

 

I have an HC2, a Netatmo Weather station, 7 Netatmo Thermostat and 5 Danfoss lc13 thermostatic valves, plus other zwave devices not interesting for the topic.

 

I managed to get the Netatmo plugin working, and now I see all the thermostats as single devices, plus I can control them manually, but I don't see them as temperature sensors nor as thermostats, so I cannot use them in the heating panel or in scenes.

I can use only the weather station readings, which (for me) are pretty useless since it is in a single room while I want to control every room separately.

 

Is this how it is supposed to work or am I missing something?

 

Thanks in advance

Link to comment
Share on other sites

  • 0
Guest Lode
  • Inquirer
  • 37 minutes ago, kdikomunismo said:

    ............................

     

    I have an HC2, a Netatmo Weather station............................

    He has....:-D

    Link to comment
    Share on other sites

    • 0
    Guest Lode
  • Inquirer
  • 35 minutes ago, kdikomunismo said:

    @omer

    It's not clear at all, but to see your Netatmo thermostat you need a Netatmo weather station.

     

    Sorry, i've been reading to fast.

    Can you post a screenshot ?

    Edited by Lode
    Link to comment
    Share on other sites

    • 0

    I was replying to omer, who never said that he has one.

     

    The one that for sure has one it's me, both posts you are referring to are mine...

    Link to comment
    Share on other sites

    • 0
    Guest Lode
  • Inquirer
  • 2 minutes ago, kdikomunismo said:

    I was replying to omer, who never said that he has one.

     

    The one that for sure has one it's me, both posts you are referring to are mine...

    Correct i saw that too late.

    Can you post a screenshot ?

    Link to comment
    Share on other sites

    • 0

    Yes, sure.

     

    This is a room with a Netatmo thermostat, I can expand the device and change its parameters, but the panel tells me there are no temperature sensors nor thermostats

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
    Guest Lode
  • Inquirer
  • 16 minutes ago, kdikomunismo said:

    Yes, sure.

     

    This is a room with a Netatmo thermostat, I can expand the device and change its parameters, but the panel tells me there are no temperature sensors nor thermostats

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Can you change the value of "Main temperature sensor" in the second screenshot ?

    Link to comment
    Share on other sites

    • 0
    Guest Lode
  • Inquirer
  • 5 minutes ago, kdikomunismo said:

    Nope (see screenshot).

    Same thing with "The main thermostat:" menu

    Please login or register to see this attachment.

    And in "Devices" they are all set to the exact room ?

    Link to comment
    Share on other sites

    • 0

    Yes, the only "unassigned" is the general Netatmo plugin, wich is the one I use to set the connection parameters and give the "get devices" command

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...