Arduino bibliotek (Gör din egen sensor)

Moderator: Telldus

bergetun
Posts: 35
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by bergetun » Tue Oct 08, 2019 10:25 pm

Thanks for trying to help me Micke, but i seem to need to have this in with a spoon :oops:

I think I understand the Sensortype flags, but i dont understand what the scale flags does. Is the sensortype and scale connected in some way ? How do i know witch one is supposed to be connected.

Lets say i have a sensor thats pops up as a temperature sensor in live.telldus.com called "MySensor" . I want this sensor to be converted to a "Volt sensor"

Will this psudo lua code do the trick to convert the temperature sensor to a volt sensor in live.telldus.com ? I am using the sensortype "UNKNOWN" beacuse i dont know witch one to use with the SCALE_POWER_VOLT scaletype.

Code: Select all

SCALE_POWER_VOLT = 4
UNKNOWN = 0

local deviceManager = require "telldus.DeviceManager"
local sensor = deviceManager:findByName("MySensor")

function onSensorValueUpdated(device, valueType, value, scale)
   if device:id() == sensor:id()
   {
         sensor:setSensorValue(UNKNOWN, value, SCALE_POWER_VOLT)
   }

I really appriciate your help

micke.prag
Site Admin
Posts: 2242
Joined: Thu Jan 18, 2018 11:08 am
Location: Lund
Contact:

Re: Arduino bibliotek (Gör din egen sensor)

Post by micke.prag » Wed Oct 09, 2019 7:39 am

Scales are depending on the sensor type. For instance Celcius can only be used together with Temperature. In your case you need to specify valueType=POWER.

Code: Select all

SCALE_POWER_VOLT = 4
VALUE_TYPE_POWER = 256

local deviceManager = require "telldus.DeviceManager"
local sensor = deviceManager:findByName("MySensor")

function onSensorValueUpdated(device, valueType, value, scale)
   if device:id() == sensor:id()
   {
         sensor:setSensorValue(VALUE_TYPE_POWER, value, SCALE_POWER_VOLT)
   }
Micke Prag
Software
Telldus Technologies

bergetun
Posts: 35
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by bergetun » Wed Oct 09, 2019 11:58 am

Fantastic @Micke, it works :)

Thank you so much for your help.

The only issue i have now is that the sensor pops up with both Voltage and Temperature with the same value (See attachment)

Is it possible to remove the Temperature part of the sensor.?

Maybe its possible to create a dummy sensor with only voltage with values from a real sensor?

Image

micke.prag
Site Admin
Posts: 2242
Joined: Thu Jan 18, 2018 11:08 am
Location: Lund
Contact:

Re: Arduino bibliotek (Gör din egen sensor)

Post by micke.prag » Thu Oct 10, 2019 9:31 am

Unfortunately you cannot do this yourself (yet). Contact the support, they can help you.
Micke Prag
Software
Telldus Technologies

Mrtiger
Posts: 12
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by Mrtiger » Thu Jan 09, 2020 2:02 pm

Is this the arduino library you used
https://github.com/zagor/FineOffset

I have a arduino uno card that i read voltage from a battery from a solarpanel and i want to get his voltage parameter to show up in telldus live.
That i need now is a transmitter i can install on the uno card( waiting for this https://www.ebay.com/itm/433Mhz-Wireles ... SwvV1ba-H7 ) and send the information(volt) to telldus.
Not sure about the program for transmitter and telldus for the arduino yet.

Mrtiger
Posts: 12
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by Mrtiger » Thu Jan 16, 2020 2:12 pm

Hei,
Har det samme problemet med at jeg vil forandre temperatur til Volt slik som postene over.
Hvordan legger jeg inn eller hvor skal jeg legge inn de scriptene som er nevnt over her?
Attachments
telldus temp-volt.JPG
telldus temp-volt.JPG (41.12 KiB) Viewed 2849 times

bergetun
Posts: 35
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by bergetun » Thu Jan 16, 2020 2:26 pm

Mrtiger wrote:
Thu Jan 16, 2020 2:12 pm
Hei,
Har det samme problemet med at jeg vil forandre temperatur til Volt slik som postene over.
Hvordan legger jeg inn eller hvor skal jeg legge inn de scriptene som er nevnt over her?
Jeg har et script for å gjøre dette. Kontakt meg på facebook, så kan jeg forklare det
mvh
Jimmy Bergetun

Mrtiger
Posts: 12
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by Mrtiger » Thu Jan 16, 2020 5:56 pm

Melding sendt på FC

Mrtiger
Posts: 12
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by Mrtiger » Sat Jan 18, 2020 12:13 pm

bergetun wrote:
Thu Jan 16, 2020 2:26 pm
Mrtiger wrote:
Thu Jan 16, 2020 2:12 pm
Hei,
Har det samme problemet med at jeg vil forandre temperatur til Volt slik som postene over.
Hvordan legger jeg inn eller hvor skal jeg legge inn de scriptene som er nevnt over her?
Jeg har et script for å gjøre dette. Kontakt meg på facebook, så kan jeg forklare det
mvh
Jimmy Bergetun
Hvilket script brukte du som grunnlag for dette, olof sitt eller tronde sitt forslag?

Paxman
Posts: 64
Joined: Thu Jan 18, 2018 11:08 am

Re: Arduino bibliotek (Gör din egen sensor)

Post by Paxman » Wed Jan 29, 2020 11:44 am

bergetun wrote:
Thu Jan 16, 2020 2:26 pm
Jeg har et script for å gjøre dette. Kontakt meg på facebook, så kan jeg forklare det
mvh
Jimmy Bergetun
Du skulle inte kunna förklara här på forumet så andra kan ta del av lösningen Jimmy?

Jag är i behov att byta enhet på en lufttryckssensor som visas som mm/h istället för mbar/hpa. Jag fick fantastisk hjälp av tronde för att få igång sensorn och få den att dyka upp i Live!. Sensorn är byggd av en Arduino Nano, en BMP280-sensor samt en FS1000A sändare. Sändningen sker över PCR800-protokollet.

Det är inte på något sätt viktigt att ändra enheten i Live!, men det är ju kul att lära sig nya grejer...och ska jag vara helt ärlig så är det lite störande ändå... :roll:

Mvh
Fred

Post Reply