ioBroker / AdapterRequests

This Place is used to track the status of new Adapter-Requests.
249 stars 36 forks source link

Samsung air conditioners #77

Open Anzic23 opened 6 years ago

Anzic23 commented 6 years ago

what we found: http://clockwerx.blogspot.com/2013/01/hacking-samsung-smart-air-conditioners.html http://clockwerx.blogspot.com.au/2014/01/samsung-air-conditioners-direct.html https://bitbucket.org/CloCkWeRX/samsung-remote perl script - https://gist.github.com/freman/e7568c625545629b6466 first, you need to add the following NPM packages to the JS driver: events, util, tls, carrier, node-samsung-airconditioner then write a script that polls the air conditioner for token:

//var airconditioner = require('node-samsung-airconditioner');
var API = require('node-samsung-airconditioner');

var connecting_to = {};

var known_tokens = {};

new API().on('discover', function(aircon) {

  if (connecting_to[aircon.options.ip]) { 
    return; 
  }
  if (aircon.options.ip != '192.168.1.3') {
    return;
  }
  known_tokens[aircon.options.ip] = '';

  // Do we need to find get a token?
  if (!known_tokens[aircon.options.ip]) {
    connecting_to[aircon.options.ip] = true;

    aircon.get_token(function(err, token) {
      if (!!err) return console.log('get_token error: ' + err.message);

      console.log('Token is ' + token);
      known_tokens[aircon.options.ip] = token;
      connecting_to[aircon.options.ip] = false;

    }).on('waiting', function() {
      console.log('Please power on the device within the next 30 seconds');
    });

    return;
  }

  connecting_to[aircon.options.ip] = true;
  aircon.login(known_tokens[aircon.options.ip], function() {
    aircon.onoff(true);

    setTimeout(function() { aircon.onoff(false); }, 5*60 * 1000);
  }).on('stateChange', function(state) {
    console.log("State changed");
    console.log(state);
  }).on('loginSuccess', function () {
    console.log("HIDSFDs");
    aircon.status();
  });

}).on('error', function(err) {
  console.log('discovery error: ' + err.message);
});
//var connecting_to = {'192_168_1_3'};
Apollon77 commented 6 years ago

ggf mal https://forum.iobroker.net/viewtopic.php?f=36&t=12182&e=1&view=unread#unread ansehen?

Apollon77 commented 6 years ago

Homebridge modules exist: homebridge-samsung-airconditioner as example.

Please check if the new ioBroker.ham Adapter can help here: see https://forum.iobroker.net/viewtopic.php?f=36&t=14972

Anzic23 commented 4 years ago

This package does not work with ham.

Apollon77 commented 4 years ago

What error you get? or is it because you use homebridge 1.x? Downgrade to 0.4.5

Anzic23 commented 4 years ago

[Climatizzatore] Power function failed /bin/sh: 1: jq: not found fix it with sudo apt-get install jq homebridge 0.4.5 homebridge is running in local mode? Now log seys:

2020-05-13 22:41:38.678  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Operation.power'
2020-05-13 22:41:38.685  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Mode.modes[0]'
2020-05-13 22:41:38.711  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Temperatures[0].desired'
2020-05-13 22:41:38.718  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] Mettere modalita
2020-05-13 22:41:38.719  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Mode.modes[0]'
2020-05-13 22:41:38.731  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Temperatures[0].current'
2020-05-13 22:41:38.749  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] azz
2020-05-13 22:41:38.750  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] Power function OK
2020-05-13 22:41:38.750  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.750  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.751  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] NON LO SO
2020-05-13 22:41:38.777  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] Power function OK
2020-05-13 22:41:38.777  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.778  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.797  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] azz
2020-05-13 22:41:38.798  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] TEMPERTURA DESIDERTA
2020-05-13 22:41:38.798  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.799  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] NaN
2020-05-13 22:41:38.805  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] Power function OK
2020-05-13 22:41:38.805  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] 
2020-05-13 22:41:38.806  - debug: ham.0 (10542) [5/13/2020, 10:41:38 PM] [Climatizzatore] Temperatura corrente: NaN
2020-05-13 22:43:12.432  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Operation.power'
2020-05-13 22:43:12.440  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Mode.modes[0]'
2020-05-13 22:43:12.450  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Temperatures[0].desired'
2020-05-13 22:43:12.466  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] Mettere modalita
2020-05-13 22:43:12.467  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Mode.modes[0]'
2020-05-13 22:43:12.482  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer 6df5f9a0-82a8-4680-9110-f10f7fbf050f" --cert /opt/iobroker/node_modules/iobroker.ham/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X GET https://192.168.1.14:8888/devices|jq '.Devices[0].Temperatures[0].current'
2020-05-13 22:43:12.498  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] azz
2020-05-13 22:43:12.498  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] Power function OK
2020-05-13 22:43:12.499  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.499  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.500  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] NON LO SO
2020-05-13 22:43:12.507  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] TEMPERTURA DESIDERTA
2020-05-13 22:43:12.508  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.509  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] NaN
2020-05-13 22:43:12.534  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] Power function OK
2020-05-13 22:43:12.535  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.535  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] Temperatura corrente: NaN
2020-05-13 22:43:12.546  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] Power function OK
2020-05-13 22:43:12.547  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.547  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] 
2020-05-13 22:43:12.548  - debug: ham.0 (10542) [5/13/2020, 10:43:12 PM] [Climatizzatore] azz