Announcement

Collapse
No announcement yet.

How to send Output value from arduino to HS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • khriss75
    replied
    Originally posted by DonMor View Post
    The sendhs is only for input, and the fromhs is only for output, I need the to be able to read and write the output without using the HS script or event
    It was my similar "problem", send a value from arduino API to a out device (like the bedroom light).
    In this way, I can switch on and off light from homeseer and from arduino.
    My solution is move from arduino plugin to mqtt plugin.
    This is a very good solution for me.
    Example, I have a bedroom switch and light (switch input, light output).
    With arduino plugin i had a script: if switch (input) value change --> toggle light (output).
    I want to use a arduino board independent from homeseer.
    So my sketch on arduino is: if switch (input) value change --> toggle light (output) and it work without homeseer. When output change, arduino send a mqtt data to homeseer that update the bedroom light device. If I press "OFF" on the bedroom light device (on homesser webpage), hs send an mqtt data to arduino, arduino switch off the bedroom light. In this way, I can toggle the bedroom light even if homeseer (or arduino plugin, or wifi (for esp8266)) is down. Every change is reported from<->to homeseer by mqtt data.
    Now I'm working to write the sketch for all my devices in order to have my home automation independent from HS. HS is used for complex event but if a night I arrive to home and hs server is down, I can switch on all my lamps in home...

    Leave a comment:


  • Guest
    Guest replied
    I have similar problem with API. I building device and part of the functionality is simple light switch. I want to control light locally on Arduino using momentary switch (toggle on / off - one touch is one, another touch is off). Variable that change by the switch I am using to control relay - on/off. Also I want to control this variable by HS3 - on/off. In this case I am creating two devices - Input - to see the state of light that I am changing on Arduino and output to control from HS3. The problem is synchronization between Input and Output device. I found workaround but its kind of little complicated and unclear. I think it more clear if it will be one device. What if you will create another (third) type of Devices - synced or reciprocal or Input/Output or I don't know how to call it better. The main feature - that this will be single device that you can change remotely and read current state on HS3 (read and write - same device). Like devices on z-wave - you switching light on wall and from HS and its the same device. What you think Greig.

    Andrew

    Leave a comment:


  • DonMor
    replied
    I know I can use an event but it would be so simple to be able to do it in the api, this should not be so hard to do

    Leave a comment:


  • enigmatheatre
    replied
    OK I would use a new input device to trigger an event to set the device to 0 then in your sketch trigger the device when you receive 100. Can I ask why not just have the output toggle on and of again after x seconds?

    Leave a comment:


  • DonMor
    replied
    I have an Homeseer device Output On=100 Off=0 that is create from the Homeseer Arduino config

    I can use the FromHS() to read the value that is perfect. when I read 100 the arduino API will do something.

    then in the Arduino API I need to set the Homeseer device Output to 0, this is what i can't do.

    Leave a comment:


  • enigmatheatre
    replied
    Originally posted by DonMor View Post
    The sendhs is only for input, and the fromhs is only for output, I need the to be able to read and write the output without using the HS script or event
    I am sorry I do not understand what you mean by read an output? Can you explain what you are trying to do in the real world? eg. what you have set up as IO and what you want to go on and off when with what you want to monitor in HS.
    Greig.

    Leave a comment:


  • DonMor
    replied
    The sendhs is only for input, and the fromhs is only for output, I need the to be able to read and write the output without using the HS script or event

    Leave a comment:


  • enigmatheatre
    replied
    You can send to and receive the value from HS with FromHS() and SendToHS() and other coding is to be done in your code in the sketch or in an event in HS.

    Greig.

    Leave a comment:


  • DonMor
    replied
    I would like to be able from the arduino api to change the value of output in Homeseer, when I read fromhs() it trigger a function in the api then if an other condition append in the api I need to turn off the homeseer output.

    Leave a comment:


  • enigmatheatre
    replied
    Originally posted by DonMor View Post
    Greig,

    As I'm using the HS output to activate a fonction in my Arduino API, can you add the possibility to be able to send to HS output the value. Same as you do with the Input?

    Don
    Don,

    I am not 100% sure I understand what you are trying to do. I think you want to get the value of an output device in your sketch. If so use the following.

    To Recieve data from Homeseer look up the FromHS array that is updated when the device value changes.
    Eg.. FromHS[5] would be the data from API Output device 5

    Greig.

    Leave a comment:


  • DonMor
    replied
    Greig,

    As I'm using the HS output to activate a fonction in my Arduino API, can you add the possibility to be able to send to HS output the value. Same as you do with the Input?

    Don

    Leave a comment:


  • enigmatheatre
    replied
    Originally posted by DonMor View Post
    Just to really understand, the SendToHS(Device ,Value ) will update only the Input, and FromHS(Device) will read the Ouput, Arduino API don’t update HS output if it change in my program?
    Correct. If you want to change a value in homeseer you need to add SendToHS( Device , Value ) to your code where the output is updated.

    eg:
    Code:
        // if the LED is off turn it on and vice-versa:
        if (ledState == LOW) {
          ledState = HIGH;
          SendToHS( 1 , 1 ); 
        } else {
          ledState = LOW;
          SendToHS( 1 , 0 ); 
        }
    Greig.

    Leave a comment:


  • bdraper
    replied
    There is an example in this post, see https://forums.homeseer.com/forum/an...vo-and-onewire

    It has pictures of the devices in HomeSeer, Arduino set up and the API code used on the NodeMCU board.

    I hope this helps.

    Leave a comment:


  • DonMor
    replied
    Originally posted by enigmatheatre View Post
    I am not sure I understand 100% but I think you just need the SendToHS(Device ,Value ) to be called in your sketch to update the homeseer device with the value of your output.


    To Send Data to Homeseer use SendToHS(Device,Value) you can send a int, Long or Float to Homeseer. Eg.. SendToHS(1,200); where 1 is the API device in homeseer and 200 is the value to send In your code

    To Receive Data from Homeseer use FromHS(Device) this is an array of the values of your output devices in Homeseer. You can then do what you want with the value. Eg.. digitalWrite(MyPin, FromHS[5]); would set MyPin to the same value as API Output device 5

    Greig.
    Just to really understand, the SendToHS(Device ,Value ) will update only the Input, and FromHS(Device) will read the Ouput, Arduino API don’t update HS output if it change in my program?

    Leave a comment:


  • enigmatheatre
    replied
    Originally posted by DonMor View Post
    What I need is to be able to send SendToHS in the API to change a value in HS that is not part of Arduino plugin (hs.SetDeviceValueByRef(50, 100, True)), at the same time do you think we could have the possibility to read other HS value by reference number. This would give a wide possibility for the API
    Both can be done with a small script or an event by setting the device you want to the other device value. If you have the easy trigger plugin this is done very easily.

    Greig.

    Leave a comment:

Working...
X