• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some help with (Generic) Weather protocol
#1
What I try to accomplice is a configuration with plight and JeeNodes. The RPi receives nicely all the messages from the JeeNodes (Light, Temperature, Humidity, Battery status, Motion and the lot). To see the temperature and humidity (light will be the next step) I have configured a Generic Weather device like this:
Code:
"Klimaat": {
    "name": "Klimaat",
    "protocol": [ "generic_weather" ],
    "id": [{
        "id": 129
    }],
    "temperature": 0,
    "humidity": 0,
    "battery": 0,
    "settings": {
            "decimals": 1
    }
}

This shows nicely in the web interface.

What I expect is that the temperature and humidity can be changed by sending a message to plight like this:
Code:
{
    "message":"send",
    "code":{
            "location":"Instellingen",
            "device":"Klimaat",
            "temperature":220,
            "humidity":550
        }
}

.. but that is not the case… Am I doing something wrong?
 
Reply
#2
You're mixing the sender, controller and gui api:
http://www.pilight.org/development/api/
 
Reply
#3
You should send something like this:
Code:
{
    "message":"send",
    "code":{
        "battery":1,
        "id":1,
        "protocol":[ "generic_weather" ]
        }
}
 
Reply
#4
curlymo Wrote:You're mixing the sender, controller and gui api

But I'm using the same program (via sockets) for switching lights at al. Connecting as a "controller", receiving the configuration and than send messages to the pilight-daemon.
Code:
stdClass Object
(
    [message] => send
    [code] => stdClass Object
        (
            [location] => Woonkamer
            [device] => Zithoek
            [state] => on
        )

)
(The somewhat weird representation is the way php "print_r()" displays JSON objects)

Why does that "work" for sending "on/off" states and dim-levels but not for sending a "temperature" value?
 
Reply
#5
The correct syntax for a controller is:
Code:
{
    "message": "send",
    "code": {
        "location": "Instellingen",
        "device": "Klimaat",
        "values": {
            "temperature": 220,
            "humidity": 550
        }
    }
}
 
Reply
#6
@curlymo, fast as ever!

Already tried that, does not work..
Code:
stdClass Object
(
    [message] => send
    [code] => stdClass Object
        (
            [location] => Instellingen
            [device] => Klimaat
            [values] => stdClass Object
                (
                    [temperature] => 220
                    [humidity] => 550
                )

        )

)

What does work is:
Code:
pilight-send -p generic_weather -i 120 -t 210


Come to think of it, how do I read the protocol Wiki?

Some Weather protocol state:
Code:
Feature    Support
Sending        OK    
Receiving      NOT
Config       OK
While others state:
Code:
Feature    Support
Sending       NOT    
Receiving       OK
Config       OK
I just don't get it….

But still the obvious does not seem to work…
 
Reply
#7
I tested that code with the controller client and it works with no issues. Are you sure the string are defined as string and the number as numbers?
 
Reply
#8
curlymo Wrote:Are you sure the string are defined as string and the number as numbers?
Good point!
And YES there are quotes around the numbers.. something json_encode() does all by it self..

Code:
json_encode($object, JSON_NUMERIC_CHECK);

does the trick!!!

Thanks for your help!!!

In the mean time I do have my values updated in the GUI (and the Control.json file) by using the plight-send command. But thats not the way I want to do it...
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  MQTT subscribe to a weather station? peteratoce 5 520 04-08-2020, 07:17 AM
Last Post: curlymo
  Protocol Program PID AdHoc-Client Bigmama 12 2,141 01-26-2019, 07:36 PM
Last Post: Bigmama
Exclamation pilight detect wrong protocol quigg_gt9000 is not quigg_gt1000 PCT 1 1,404 08-12-2018, 11:13 AM
Last Post: Niek
  need some help with program protocol charlesjacob4695 1 806 05-15-2018, 05:58 PM
Last Post: curlymo
  problem with alecto_wx500 protocol (pilight V7) TheWheel 18 7,475 04-12-2018, 06:38 PM
Last Post: NevelS
  deleyCON remote plug socket (arctec_screen_old protocol) itsMe 6 1,863 04-01-2018, 08:35 PM
Last Post: itsMe
  Problem with Protocol gpio_switch engel035 15 4,353 03-19-2018, 06:46 PM
Last Post: curlymo
  arctech_contact protocol missing open/close signals Niek 2 1,051 12-23-2017, 07:16 PM
Last Post: Niek
  Extend generic protocol mickey.lm 6 1,723 11-20-2017, 10:51 PM
Last Post: mickey.lm
Star How to bind new protocol with GUI polo 11 3,211 11-12-2017, 10:12 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)