Forum użytkowników automatyki budynkowej

Z-wave => Fibaro - urządzenia wirtualne, pluginy => Wątek zaczęty przez: Tomasz karas w Luty 15, 2016, 01:28:03 pm

Tytuł: Hue czajnik i express na Wifi plugin potrzebny
Wiadomość wysłana przez: Tomasz karas w Luty 15, 2016, 01:28:03 pm
witam.
mam w domu:
http://ispot.pl/inteligentny-dom/smarter-coffee-machine-ekspres-przelewowy-z-mlynkiem-sterowany-za,id-76127
http://ispot.pl/inteligentny-dom/philips-hue-connected-light-bulb-starter-set-v2-zestaw,id-76070?4clk=UEhJOTI5MDAxMTQyMDAxLDE4NiwxNDU1NTI4Nzc5LDEsNDM5NjVjYzM3ZDEyNTZhOTIxOWNjZDMyNTUzOTQyMzM
http://ispot.pl/inteligentny-dom/smarter-ikettle-20-czajnik-sterowany-za-pomoca-smartfona,id-76126
Chce kupić centralkę fibaro za 1100.
Czy ktos moze napisac skrypty do fibaro by on mogl obsłużyć te urządzenia?
Jaki byłby koszt?
Jestem osoba prywatna wiec wiadomo cena ma znaczenie
No i sterowanie z iPhone
Pozdrawiam
Tytuł: Odp: Hue czajnik i express na Wifi plugin potrzebny
Wiadomość wysłana przez: viperlodz w Luty 15, 2016, 02:29:41 pm
Którą centralkę? Home Center Lite?
Tytuł: Odp: Hue czajnik i express na Wifi plugin potrzebny
Wiadomość wysłana przez: Tomasz karas w Luty 15, 2016, 02:32:27 pm
Tak. Chyba ze ta droższa musi byc. Chyba ze cos polecisz
Tytuł: Odp: Hue czajnik i express na Wifi plugin potrzebny
Wiadomość wysłana przez: viperlodz w Luty 15, 2016, 05:30:39 pm
Na HCL nie ma możliwości pisania skryptów więc od razu odpada.
Co do kawy:
http://adenforshaw.com/smarter-coffee-machine-raspberry-pi-iot-coffeetime/
a dalej trzeba by poszukać;)
Tytuł: Odp: Hue czajnik i express na Wifi plugin potrzebny
Wiadomość wysłana przez: andre w Luty 15, 2016, 06:45:30 pm
Dla integracji z HC 2 tutaj był opis :  http://www.fibarouk.co.uk/integrating-the-ikettle-and-sonos-on-a-fibaro-home-center-2/
Edit: znalazłem u siebie jeszcze to:
--[[

 iKettle

 This virtual device has been created by and is copyright (c) 2014, Fibaro UK Ltd
 http://www.FibaroUK.co.uk/

 You may use this virtual device for personal or commercial purposes however
 please respect our intellectual property and leave this comment block intact
 and unmodified.

]]

-- VERSION 1.1
-- change log at bottom of main loop

--[[

At the top of this page, make sure you change:
    - The IP address to that of the iKettle
    - The TCP Port to 2000

  This virtual device uses a global variable to pass status changes to other scenes
  you must create the global variable in panels->variables in order to use this feature.
  The global variable should be called 'iKettleFB'

]]

-- Only run this block of code once when we first connect to the iKettle
if not (started == 'YES') then
  started = 'YES'
 
  actionTable = {
    a0x100 = '100C selected',
    a0x95 = '95C selected',
    a0x80 = '80C selected',
    a0x65 = '65C selected',
    a0x11 = 'Warm selected',
    a0x10 = 'Warm has ended',
    a0x5 = 'Turned on',
    a0x0 = 'Turned off',
    a0x8005 = 'Warm length is 5 minutes',
    a0x8010 = 'Warm length is 10 minutes',
    a0x8020 = 'Warm length is 20 minutes',
    a0x3 = 'Reached temperature',
    a0x2 = 'Problem (boiled dry?)',
    a0x1 = 'Kettle was removed (whilst on)'
  }
 
  buffer = '' -- create an empty buffer
 
  local thismodule = fibaro:getSelfId()
  local ip = fibaro:getValue(thismodule, 'IPAddress')
  local port = fibaro:getValue(thismodule, 'TCPPort')

  tcpSocket = Net.FTcpSocket(ip, port)
  tcpSocket:setReadTimeout(1000)
  bytes, errorCode = tcpSocket:write("get sys status\n")
  fibaro:debug('Connected to iKettle')
  fibaro:log('Connected')
end

function bit(bitNum)
  return 2 ^ (bitNum - 1)
end

function hasbit(data, p)
  return data % (p + p) >= p
end

function setbit(data, p, setIt)
  if (setIt) then
    return hasbit(data, p) and data or data + p
  else
    return hasbit(data, p) and data - p or data
  end
end

function processKey(key)
  return {
    on      = hasbit(key, bit(1)),
    warm    = hasbit(key, bit(2)),
    temp65  = hasbit(key, bit(3)),
    temp80  = hasbit(key, bit(4)),
    temp95  = hasbit(key, bit(5)),
    temp100 = hasbit(key, bit(6))
    }
end

function setGV(value)
  fibaro:setGlobal('iKettleFB', value)
end

function processCommand(cmnd)
  -- a command will always start with 'sys status '
  -- so we can remove the first 11 characters.
  local action = string.sub(cmnd, 12) -- from the 12th char onwards
 
  pos = string.find(action, "key=")
  if (pos) then
    -- this is a response to a get sys status request
    state = processKey(string.byte(action, 5, -1))
    local res = ''
    if (state.on) then
      res = res .. 'On'
      setGV('0x5')
    else
      res = res .. 'Off'
      setGV('0x0')
    end
    if state.warm then
      res = res .. ' and warming'
      setGV('0x11')
    end
    if state.temp65 then
      res = res .. ' at 65 degrees'
      setGV('0x65')
    end
    if state.temp80 then
      res = res .. ' at 80 degrees'
      setGV('0x80')
    end
    if state.temp95 then
      res = res .. ' at 95 degrees'
      setGV('0x95')
    end
    if state.temp100 then
      res = res .. ' at 100 degrees'
      setGV('0x100')
    end
    return res .. '.'
  else
    --- this is an asyncronus status update
    setGV(action)
    message = actionTable['a' .. action] or action
    return message .. '.'
  end
end

function parseIt(buf)
  -- find the first occurance of 'set state '
  pos = string.find(buf, "sys status ")
  if (pos) then
    buf = string.sub(buf, pos) -- trim any junk from the beginning
    endPos = string.find(buf, '\r')
    while (endPos) do
      -- we have a potential command
      command = string.sub(buf, 1, endPos-1)
      buf = string.sub(buf, endPos + 1)
     
      local feedback = processCommand(command)
      fibaro:call(fibaro:getSelfId(), "setProperty", "ui.labStatus.value", feedback)
      fibaro:debug(feedback)
      fibaro:log(feedback)
     
      endPos = string.find(buf, '\r')
    end
  end
  return buf
end

state = tcpSocket:read()
if (tostring(state) ~= '') then
  buffer = (buffer .. state)  -- add anything we read from the socket to the buffer
  buffer = parseIt(buffer) -- process any useful stuff from the buffer and keep the leftovers
end

--[[

Change log

1.1
- Added buttons for warm on/off, 5 mins, 10 mins and 20 mins.
- Added support for HCL (no feedback)

1.0
- Initial release Buttons: [On,Off,100,95,80,65], Status - all feedback

]]